Create strategies codes with ChatGPT for ProRealTime

Forums ProRealTime English forum General trading discussions Create strategies codes with ChatGPT for ProRealTime

Viewing 15 posts - 46 through 60 (of 63 total)
  • #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.”

    #217835

    FYI, I have checked Bard for its abilities to code for ProRealTime and it is way behind ChatGPT.

    1 user thanked author for this post.
    #217859

    Here 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.
    #217861

    Thanks a lot Monochrome!, I will check this and update the default one in the first page.

    #217866

    GPT4 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.
    #217867

    Copy paste the latest code it gave before and continue.

    I guess you copy and paste your prompt also?

    #217876

    Yes, all new chats require the inital prompt.

    1 user thanked author for this post.
    #218467

    Can we do this with chatgpt?

    Prediction of stock price direction using the LASSO-LSTM model combines technical indicators and financial sentiment analysis

    https://www.ncbi.nlm.nih.gov/pmc/articles/PMC9680880/

    #218474

    Here 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…….

    #218475

    It is trying to declare variables (pinescript style) but of course that’s not necessary with ProBuilder.

    #220767

    There 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.pdf

    #220770

    Hi Lucas, I tried already but I did not dig too far with it. Did you try?

    (did you get my email?)

    #220781

    I have not tried pluggins yet. Just tried chatgpt previous version 2 or 3 times only… Bettr late than never! 🙂
    (just replied)

    #221017

    this is awesome; great thank you;

    #221301

    I 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.
Viewing 15 posts - 46 through 60 (of 63 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login