ChatGTP AI Coder
Forums › ProRealTime English forum › ProOrder support › ChatGTP AI Coder
- This topic has 19 replies, 6 voices, and was last updated 1 year ago by Nicolas.
-
-
05/07/2023 at 7:53 AM #214246
I tried to use ChatGTP to code a strategy but failed.
Anyone who manage?
Create a robust strategy , use ProBuilder Language for ProRealTime
Sure, here’s an example of a robust strategy for trading the NASDAQ index using ProBuilder Language for ProRealTime. This strategy uses a combination of moving averages, standard deviation, and a trailing stop loss to identify buy and sell signals:
12345678910111213141516171819202122232425262728293031323334353637383940// Moving Average PeriodsDim MA_Short_Period As Integer = 20Dim MA_Long_Period As Integer = 50// Standard Deviation MultiplierDim SD_Multiplier As Double = 2.0// Stop Loss and Take ProfitDim Stop_Loss_Percentage As Double = 0.01 // 1%Dim Take_Profit_Percentage As Double = 0.02 // 2%// Trailing Stop LossDim Trailing_Stop_Loss_Percentage As Double = 0.005 // 0.5%// Calculate Moving AveragesDim MA_Short As Double = Average[MA_Short_Period](Close)Dim MA_Long As Double = Average[MA_Long_Period](Close)// Calculate Standard DeviationDim SD As Double = StandardDeviation(Close, MA_Long_Period, 1)// Calculate Upper and Lower BandsDim Upper_Band As Double = MA_Long + (SD_Multiplier * SD)Dim Lower_Band As Double = MA_Long - (SD_Multiplier * SD)// Buy SignalIf Close > MA_Short And Close > MA_Long And Close < Upper_Band ThenBuy Next Bar at CloseSetStopLoss(Stop_Loss_Percentage * Close)SetProfitTarget(Take_Profit_Percentage * Close)SetTrailingStop(Trailing_Stop_Loss_Percentage)End If// Sell SignalIf Close < MA_Short And Close < MA_Long And Close > Lower_Band ThenSell Next Bar at CloseSetStopLoss(Stop_Loss_Percentage * Close)SetProfitTarget(Take_Profit_Percentage * Close)SetTrailingStop(Trailing_Stop_Loss_Percentage)End If05/07/2023 at 9:51 AM #21425205/07/2023 at 10:22 AM #21425405/07/2023 at 10:28 AM #214255ChatGPT v4 (paid version) is better in many ways, but still have to define some infos before creating a prompt.
I asked:
“code a compatible simple RSI strategy for prorealtime”
and the answer is:
ProRealTime is a technical analysis and trading software platform that allows users to create custom trading strategies using its programming language, ProBuilder. Here’s a simple RSI (Relative Strength Index) strategy for ProRealTime:
- Define the parameters for the RSI calculation and the overbought and oversold levels.
- Calculate the RSI based on the defined parameters.
- Implement the buy and sell conditions based on the overbought and oversold levels.
- Manage the trading positions and add stop loss and take profit levels (optional).
Here’s the code for the simple RSI strategy:
12345678910111213141516171819202122232425262728293031323334353637// ParametersRSI_Period = 14Overbought_Level = 70Oversold_Level = 30StopLoss = 2 // optional, in percentTakeProfit = 4 // optional, in percent// Calculate RSIRSI_Value = RSI[RSI_Period](close)// Buy and Sell conditionsBuy_Condition = RSI_Value crosses under Oversold_LevelSell_Condition = RSI_Value crosses over Overbought_Level// Manage positionsIF Buy_Condition THENBuy at marketStopLossLevel = close * (1 - StopLoss / 100)TakeProfitLevel = close * (1 + TakeProfit / 100)ENDIFIF Sell_Condition THENSell at marketStopLossLevel = close * (1 + StopLoss / 100)TakeProfitLevel = close * (1 - TakeProfit / 100)ENDIF// Set stop loss and take profit levels (optional)IF longonmarket THENSET STOP pLOSS StopLossLevelSET TARGET pPROFIT TakeProfitLevelENDIFIF shortonmarket THENSET STOP pLOSS StopLossLevelSET TARGET pPROFIT TakeProfitLevelENDIFThis simple RSI strategy buys when the RSI crosses under the oversold level and sells when the RSI crosses over the overbought level. It also includes optional stop loss and take profit levels. Note that this strategy is designed for educational purposes and should be tested and optimized before using it in live trading.
Almost ok, so I continue:
with probuilder language, variable names can’t contain underscore. Also, the pLOSS and pPROFIT are used for points values, not percentage, which are: %LOSS and %PROFIT
and the new code:
Apologies for the oversight. Here’s the corrected version of the simple RSI strategy for ProRealTime using ProBuilder language with the proper variable naming conventions and the correct stop loss and take profit values:12345678910111213141516171819202122232425262728293031323334353637// ParametersRSIPeriod = 14OverboughtLevel = 70OversoldLevel = 30StopLoss = 2 // optional, in percentTakeProfit = 4 // optional, in percent// Calculate RSIRSIValue = RSI[RSIPeriod](close)// Buy and Sell conditionsBuyCondition = RSIValue crosses under OversoldLevelSellCondition = RSIValue crosses over OverboughtLevel// Manage positionsIF BuyCondition THENBuy at marketStopLossLevel = close * (1 - StopLoss / 100)TakeProfitLevel = close * (1 + TakeProfit / 100)ENDIFIF SellCondition THENSell at marketStopLossLevel = close * (1 + StopLoss / 100)TakeProfitLevel = close * (1 - TakeProfit / 100)ENDIF// Set stop loss and take profit levels (optional)IF longonmarket THENSET STOP %LOSS StopLossSET TARGET %PROFIT TakeProfitENDIFIF shortonmarket THENSET STOP %LOSS StopLossSET TARGET %PROFIT TakeProfitENDIFNow, the variable names are without underscores, and the stop loss and take profit values are set using %LOSS and %PROFIT. Please note that this strategy is designed for educational purposes and should be tested and optimized before using it in live trading.
05/07/2023 at 11:12 AM #21425905/07/2023 at 11:35 AM #214260Especially since these systems seem to be kept very simple.
If you look closely, it doesn’t know how to interpret the difference between percentage and points. But it’s a start.
So too simple ? then make it complex !
…
oh
1 user thanked author for this post.
05/08/2023 at 2:37 PM #214298I had dinner with a friend a few days ago and he suggested the idea of asking ChatGPT questions, personally I think it’s a gimmick even if it looks impressive at first,
My friend asked ChatGPT to give the result of a certain chemical reaction with the exact proportions of the components, the answer was three different products but with percentages: 80% + 75% + …..
So this artificial intelligence was not even able to make a simple calculation of 100%.
05/08/2023 at 2:59 PM #214302Yea, but you forgot the vaporizing of products. 🙂 🙂
1 user thanked author for this post.
05/08/2023 at 3:08 PM #214303ChatGPT knew your friend had forgotten to state if the chemical reaction took place in air, oxygen, inert gas or whatever?? 😉
1 user thanked author for this post.
05/08/2023 at 3:15 PM #214304I’m using ChatGPT everyday, for web oriented development (PHP, JS, SQL, ..), it had saved me (literally) dozens of hours of work.
Like any new tool, you have to get used to it. I’m preparing a prompt to make it reliable for ProBuilder (for v4 version only).
1 user thanked author for this post.
05/08/2023 at 3:18 PM #214305I’m using ChatGPT everyday, for web oriented development (PHP, JS, SQL, ..), it had saved me (literally) dozens of hours of work.
Like any new tool, you have to get used to it. I’m preparing a prompt to make it reliable for ProBuilder (for v4 version only).
Hi. V4 of what?
Will the prompt be avalabile for us?
05/09/2023 at 1:40 AM #214329My friend is a chemist 😊
05/09/2023 at 1:42 AM #214330For the fun of it I’ve just created an account, I’ll test it out and we’ll see 😊
05/09/2023 at 8:08 AM #21433905/09/2023 at 11:54 AM #214370I’ve tried to understand the prices but I can’t quite figure out, is it a monthly subscription or is it a price you pay per request ?
-
AuthorPosts