ChatGTP AI Coder

Viewing 15 posts - 1 through 15 (of 20 total)
  • Author
    Posts
  • #214246 quote
    SnorreDK
    Participant
    Junior

    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:

    // Moving Average Periods
    Dim MA_Short_Period As Integer = 20
    Dim MA_Long_Period As Integer = 50
    
    // Standard Deviation Multiplier
    Dim SD_Multiplier As Double = 2.0
    
    // Stop Loss and Take Profit
    Dim Stop_Loss_Percentage As Double = 0.01 // 1%
    Dim Take_Profit_Percentage As Double = 0.02 // 2%
    
    // Trailing Stop Loss
    Dim Trailing_Stop_Loss_Percentage As Double = 0.005 // 0.5%
    
    // Calculate Moving Averages
    Dim MA_Short As Double = Average[MA_Short_Period](Close)
    Dim MA_Long As Double = Average[MA_Long_Period](Close)
    
    // Calculate Standard Deviation
    Dim SD As Double = StandardDeviation(Close, MA_Long_Period, 1)
    
    // Calculate Upper and Lower Bands
    Dim Upper_Band As Double = MA_Long + (SD_Multiplier * SD)
    Dim Lower_Band As Double = MA_Long - (SD_Multiplier * SD)
    
    // Buy Signal
    If Close > MA_Short And Close > MA_Long And Close < Upper_Band Then
        Buy Next Bar at Close
        SetStopLoss(Stop_Loss_Percentage * Close)
        SetProfitTarget(Take_Profit_Percentage * Close)
        SetTrailingStop(Trailing_Stop_Loss_Percentage)
    End If
    
    // Sell Signal
    If Close < MA_Short And Close < MA_Long And Close > Lower_Band Then
        Sell Next Bar at Close
        SetStopLoss(Stop_Loss_Percentage * Close)
        SetProfitTarget(Take_Profit_Percentage * Close)
        SetTrailingStop(Trailing_Stop_Loss_Percentage)
    End If
    
    #214252 quote
    phoentzs
    Participant
    Master

    Interesting. That comes straight from ChatGTP? For what time unit should this be intended?

    #214254 quote
    Nicolas
    Keymaster
    Master

    That’s not a compatible code, seems that ChatGPT is not yet fully compatible with our preferred trading platform 🙂

    #214255 quote
    Nicolas
    Keymaster
    Master

    ChatGPT 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:

    1. Define the parameters for the RSI calculation and the overbought and oversold levels.
    2. Calculate the RSI based on the defined parameters.
    3. Implement the buy and sell conditions based on the overbought and oversold levels.
    4. Manage the trading positions and add stop loss and take profit levels (optional).

    Here’s the code for the simple RSI strategy:

    // Parameters
    RSI_Period = 14
    Overbought_Level = 70
    Oversold_Level = 30
    StopLoss = 2 // optional, in percent
    TakeProfit = 4 // optional, in percent
    
    // Calculate RSI
    RSI_Value = RSI[RSI_Period](close)
    
    // Buy and Sell conditions
    Buy_Condition = RSI_Value crosses under Oversold_Level
    Sell_Condition = RSI_Value crosses over Overbought_Level
    
    // Manage positions
    IF Buy_Condition THEN
        Buy at market
        StopLossLevel = close * (1 - StopLoss / 100)
        TakeProfitLevel = close * (1 + TakeProfit / 100)
    ENDIF
    
    IF Sell_Condition THEN
        Sell at market
        StopLossLevel = close * (1 + StopLoss / 100)
        TakeProfitLevel = close * (1 - TakeProfit / 100)
    ENDIF
    
    // Set stop loss and take profit levels (optional)
    IF longonmarket THEN
        SET STOP pLOSS StopLossLevel
        SET TARGET pPROFIT TakeProfitLevel
    ENDIF
    
    IF shortonmarket THEN
        SET STOP pLOSS StopLossLevel
        SET TARGET pPROFIT TakeProfitLevel
    ENDIF
    

    This 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:

    // Parameters
    RSIPeriod = 14
    OverboughtLevel = 70
    OversoldLevel = 30
    StopLoss = 2 // optional, in percent
    TakeProfit = 4 // optional, in percent
    
    // Calculate RSI
    RSIValue = RSI[RSIPeriod](close)
    
    // Buy and Sell conditions
    BuyCondition = RSIValue crosses under OversoldLevel
    SellCondition = RSIValue crosses over OverboughtLevel
    
    // Manage positions
    IF BuyCondition THEN
        Buy at market
        StopLossLevel = close * (1 - StopLoss / 100)
        TakeProfitLevel = close * (1 + TakeProfit / 100)
    ENDIF
    
    IF SellCondition THEN
        Sell at market
        StopLossLevel = close * (1 + StopLoss / 100)
        TakeProfitLevel = close * (1 - TakeProfit / 100)
    ENDIF
    
    // Set stop loss and take profit levels (optional)
    IF longonmarket THEN
        SET STOP %LOSS StopLoss
        SET TARGET %PROFIT TakeProfit
    ENDIF
    
    IF shortonmarket THEN
        SET STOP %LOSS StopLoss
        SET TARGET %PROFIT TakeProfit
    ENDIF
    

    Now, 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.

    #214259 quote
    phoentzs
    Participant
    Master

    I could already imagine that the coding with ChatGPT would not work properly. Especially since these systems seem to be kept very simple. But what is interesting is that ChatGPT developed the idea itself.

    #214260 quote
    PeterSt
    Participant
    Master

    Especially 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

    phoentzs thanked this post
    image_2023-05-07_123456604.png image_2023-05-07_123456604.png
    #214298 quote
    ZeroCafeine
    Participant
    Senior

    I 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%.

    #214302 quote
    PeterSt
    Participant
    Master

    Yea, but you forgot the vaporizing of products. 🙂 🙂

    ZeroCafeine thanked this post
    #214303 quote
    GraHal
    Participant
    Master

    ChatGPT knew your friend had forgotten to state if the chemical reaction took place in air, oxygen, inert gas or whatever?? 😉

    ZeroCafeine thanked this post
    #214304 quote
    Nicolas
    Keymaster
    Master

    I’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).

    GraHal thanked this post
    #214305 quote
    SnorreDK
    Participant
    Junior

    I’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?

    #214329 quote
    ZeroCafeine
    Participant
    Senior

    My friend is a chemist 😊

    #214330 quote
    ZeroCafeine
    Participant
    Senior

    For the fun of it I’ve just created an account, I’ll test it out and we’ll see 😊

    #214339 quote
    Nicolas
    Keymaster
    Master

    ChatGPT v4 (Pro version).

    Yes, I will give deliver the prompt. Currently, I’m trialing a lot of queries in order to detect where it fails in order to modify the prompt.

    GraHal thanked this post
    #214370 quote
    ZeroCafeine
    Participant
    Senior

    I’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 ?

Viewing 15 posts - 1 through 15 (of 20 total)
  • You must be logged in to reply to this topic.

ChatGTP AI Coder


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
SnorreDK @snorredk Participant
Summary

This topic contains 19 replies,
has 6 voices, and was last updated by Nicolas
2 years, 9 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 05/07/2023
Status: Active
Attachments: 1 files
Logo Logo
Loading...