Create strategies codes with ChatGPT for ProRealTime
Forums › ProRealTime English forum › General trading discussions › Create strategies codes with ChatGPT for ProRealTime
- This topic has 76 replies, 18 voices, and was last updated 4 months ago by GraHal.
-
-
07/05/2023 at 4:17 PM #217329
@AMQ I think you have to give it more precice instructions / prompt. Something similar to
“Can you please write me a code that exits a long trade, if the chart abd candlesticks are showing a Shooting star formation or a Bearish engulfing pattern.”
07/18/2023 at 12:59 PM #217835FYI, I have checked Bard for its abilities to code for ProRealTime and it is way behind ChatGPT.
1 user thanked author for this post.
07/19/2023 at 4:25 AM #217859Here is a prompt that works for me quite well. —
I need some help generating codes for the trading platform ProRealTime. Its programming language is ProBuilder (also known as ProRealCode).
Variables names can only contain letters and numbers and always starting with a letter, no underscore and no special character allowed, also they are not case sensitive.
_To set a pending buy stop order at price X, price must be below the price X, use the instruction: BUY AT X STOP
_To add a trailing stop of X points, use the instruction: SET STOP PTRAILING X
_The upper bollinger band of period X iand deviation Y is calculated with the instruction: AVERAGE[X]+STD[X]*Y
_To get the point value in money use the constant: POINTVALUE
_To get the point size use the constant: POINTSIZE
_To get the average price of current positions use: POSITIONPRICE
_To get profit in money of current positions use this snippet:
floatingprofit = (((close-positionprice)*pointvalue)*countofposition)/pointsize //actual trade gains
Conditional IF instruction:
Syntax: IF condition THEN action ENDIF
Syntax: IF condition THEN action1 ELSE action2 ENDIF
Syntax: IF condition1 THEN IF condition2 THEN action1 ELSE action2 ENDIF ENDIF
Syntax: IF condition1 THEN action1 ELSIF condition2 THEN action2 ELSE actionN ENDIF
Iterative FOR Loop:
Syntax: FOR variable = beginningValue TO endingValue DO action NEXT
Descending loop (FOR, DOWNTO, DO, NEXT):
Syntax: FOR variable = endingValue DOWNTO beginningValue DO action NEXT
Conditional WHILE Loop:
Syntax: WHILE condition DO action1 … actionN WEND
BREAK instruction:
Used to exit a WHILE or FOR loop prematurely based on certain conditions.
CONTINUE instruction:
Used to skip the remaining code within the current iteration of a WHILE or FOR loop and move to the next iteration.
ONCE instruction:
Used to initialize a variable with a specific value “only once” during program execution.
Common unary and binary functions:
Includes functions like MIN, MAX, ROUND, ABS, SGN, SQUARE, SQRT, LOG, POW, EXP, COS, SIN, TAN, ACOS, ASIN, ATAN, FLOOR, CEIL, RANDOM.
Common mathematical operators:
Operators such as <, <= (or =<), >, >= (or =>), =, <> (not equal to).
Charting comparison functions:
CROSSES OVER and CROSSES UNDER for chart curves or lines.
Summation functions:
CUMSUM and SUMMATION for cumulative sum and sum of values over a specified number of bars.
Statistical functions:
LOWEST, HIGHEST, STD, and STE for finding lowest, highest, standard deviation, and standard error.
Logical operators:
NOT, OR, AND, XOR for performing logical operations and creating conditional expressions.
Arrays (Data tables):
Arrays are used to store multiple values or selectively store values. Prefixed with ‘$’ symbol.
ArrayMax($Array): Returns the highest defined value in the array, ignoring automatically filled zeros.
ArrayMin($Array): Returns the smallest defined value in the array, ignoring automatically filled zeros.
ArraySort($Array, MODE): Sorts the array in ascending (ASCEND) or descending (DESCEND) order, removing automatically filled zeros.
IsSet($Array[Index]): Returns 1 if the index of the array is defined, 0 if it’s not. Automatically filled zeros are not considered as defined.
LastSet($Array): Returns the highest defined index of the array. If no index is defined, it returns -1.
UnSet($Array): Resets the array by deleting its contents completely, setting all elements to 0.
Instruction to open/close positions:
Syntax: BUY, SELL, SELLSHORT, EXITSHORT for opening and closing long/short positions.
Now let’s start programming, answer “YES” and nothing else if you are ready and wait for my next prompt.
3 users thanked author for this post.
07/19/2023 at 8:33 AM #21786107/19/2023 at 9:55 AM #217866GPT4 i believe has a 32K context limit. The prompt itself is around 3k.
It works reasonable well initially, I can ask it to change, explain, add etc and its pretty good.
But after a certain amount of exchanges,ie after 32k limit, I think it takes bits and pieces from the entire conversation and replys. Here it starts too lose its attention and goes wonky.
At this point i just open a new chat, Copy paste the latest code it gave before and continue.
2 users thanked author for this post.
07/19/2023 at 10:42 AM #217867Copy paste the latest code it gave before and continue.
I guess you copy and paste your prompt also?
07/19/2023 at 2:26 PM #217876Yes, all new chats require the inital prompt.
1 user thanked author for this post.
08/02/2023 at 1:11 AM #218467Can we do this with chatgpt?
Prediction of stock price direction using the LASSO-LSTM model combines technical indicators and financial sentiment analysis
08/02/2023 at 7:50 AM #218474Here is a prompt that works for me quite well. —
I need some help generating codes for the trading platform ProRealTime. Its programming language is ProBuilder (also known as ProRealCode).Variables names can only contain letters and numbers and always starting with a letter, no underscore and no special character allowed, also they are not case sensitive.
_To set a pending buy stop order at price X, price must be below the price X, use the instruction: BUY AT X STOP
_To add a trailing stop of X points, use the instruction: SET STOP PTRAILING X
_The upper bollinger band of period X iand deviation Y is calculated with the instruction: AVERAGE[X]+STD[X]*Y
_To get the point value in money use the constant: POINTVALUE
_To get the point size use the constant: POINTSIZE
_To get the average price of current positions use: POSITIONPRICE
_To get profit in money of current positions use this snippet:
floatingprofit = (((close-positionprice)*pointvalue)*countofposition)/pointsize //actual trade gains
Conditional IF instruction:
Syntax: IF condition THEN action ENDIF
Syntax: IF condition THEN action1 ELSE action2 ENDIF
Syntax: IF condition1 THEN IF condition2 THEN action1 ELSE action2 ENDIF ENDIF
Syntax: IF condition1 THEN action1 ELSIF condition2 THEN action2 ELSE actionN ENDIF
Iterative FOR Loop:
Syntax: FOR variable = beginningValue TO endingValue DO action NEXT
Descending loop (FOR, DOWNTO, DO, NEXT):
Syntax: FOR variable = endingValue DOWNTO beginningValue DO action NEXT
Conditional WHILE Loop:
Syntax: WHILE condition DO action1 … actionN WEND
BREAK instruction:
Used to exit a WHILE or FOR loop prematurely based on certain conditions.
CONTINUE instruction:
Used to skip the remaining code within the current iteration of a WHILE or FOR loop and move to the next iteration.
ONCE instruction:
Used to initialize a variable with a specific value “only once” during program execution.
Common unary and binary functions:
Includes functions like MIN, MAX, ROUND, ABS, SGN, SQUARE, SQRT, LOG, POW, EXP, COS, SIN, TAN, ACOS, ASIN, ATAN, FLOOR, CEIL, RANDOM.
Common mathematical operators:
Operators such as <, <= (or =<), >, >= (or =>), =, <> (not equal to).
Charting comparison functions:
CROSSES OVER and CROSSES UNDER for chart curves or lines.
Summation functions:
CUMSUM and SUMMATION for cumulative sum and sum of values over a specified number of bars.
Statistical functions:
LOWEST, HIGHEST, STD, and STE for finding lowest, highest, standard deviation, and standard error.
Logical operators:
NOT, OR, AND, XOR for performing logical operations and creating conditional expressions.
Arrays (Data tables):
Arrays are used to store multiple values or selectively store values. Prefixed with ‘$’ symbol.
ArrayMax($Array): Returns the highest defined value in the array, ignoring automatically filled zeros.
ArrayMin($Array): Returns the smallest defined value in the array, ignoring automatically filled zeros.
ArraySort($Array, MODE): Sorts the array in ascending (ASCEND) or descending (DESCEND) order, removing automatically filled zeros.
IsSet($Array[Index]): Returns 1 if the index of the array is defined, 0 if it’s not. Automatically filled zeros are not considered as defined.
LastSet($Array): Returns the highest defined index of the array. If no index is defined, it returns -1.
UnSet($Array): Resets the array by deleting its contents completely, setting all elements to 0.
Instruction to open/close positions:
Syntax: BUY, SELL, SELLSHORT, EXITSHORT for opening and closing long/short positions.
Now let’s start programming, answer “YES” and nothing else if you are ready and wait for my next prompt.
I used ur promt but got this from chatgtp:
‘ Define Parameters
Dim LongEntryCondition As Boolean
Dim ShortEntryCondition As Boolean
Dim TrailingStopPoints As Integer
Dim EntryTimeframe As Integer
Dim TrailingTimeframe As Integer
Dim MovingAveragePeriod As Integer
Dim DeviationMultiplier As Float
Dim RiskPercentage As Float…….08/02/2023 at 7:53 AM #21847509/11/2023 at 3:43 PM #220767There is a pluggin for chatgpt for reading pdf files. Wouldn’t be a good idea to make chatgpt read last probuilder and probacktest/proorder guides, before asking for something ?
https://www.prorealtime.com/en/pdf/probuilder.pdf
https://www.prorealtime.com/en/pdf/probacktest.pdf09/11/2023 at 4:07 PM #22077009/11/2023 at 4:50 PM #22078109/14/2023 at 12:28 PM #221017this is awesome; great thank you;
09/19/2023 at 7:13 PM #221301I use this for the Custom instruction feature on GPT4. I dont use it to try and create a full complete strategies but rather to help me refine my own code.
I used gpt to keep refining my prompt.
Give it a try and add/ suggest anything that can improve this and post it here for everyone.
What would you like ChatGPT to know about you to provide better responses? (1500 characters)
I’m primarily looking for assistance in coding specifically in ProRealTime (PRT). My focus is on writing code that is STRICTLY compliant with PRT standards. I prefer that you first plans out the logic before jumping into coding. I don’t require explanations about the written code unless specifically asked for them. My code should be ready to be used in a real-world setting; therefore, please follow PRT’s syntax rules, loops, conditional statements, and all other constructs closely.
How would you like ChatGPT to respond? (1500 characters)
Planning: Before coding, outline the steps and logic briefly. This could be in the form of pseudocode or a bullet-point list.
Compliance: Provide STRICTLY compliant PRT code. The code should run from top to bottom and update with each new data bar.
Probuilder Limitations: Note that Probuilder (PRT) does not support the creation of custom functions. Use only PRT’s native functions and syntax.
New Array Functionality: Familiarize yourself with the newly added array functionality in PRT.
Syntax: Adhere to PRT’s syntax rules, especially variable naming. Variables should have no underscores, should be made of letters and numbers, and are case-insensitive.
Variable Initialization: Uninitialized variables default to zero. Use numerical values to represent boolean conditions: 1 for true and 0 for false.
Conditional Statements and Loops: Use IF-THEN-ELSE-ENDIF for conditional statements and adhere to PRT’s FOR and WHILE guidelines for loops.
Arrays: Utilize the $ prefix for arrays. No need for initialization. Use functions like ArrayMax($Array), ArrayMin($Array), ArraySort($Array, MODE), IsSet($Array[Index]), LastSet($Array), UnSet($Array).
Position Management: Employ BUY, SELL, SELLSHORT, EXITSHORT for trades.
Explanations: Do not provide code explanations unless explicitly asked to do so. Always print the entire code, including modifications, unless otherwise specified.
3 users thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on