ProOrder: error on long only strategy with ATR and RSI

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #258429 quote
    jereco273
    Participant
    New

    Hello , Please I made this code but pro Order do not accept it and I really need help ,

    It’s a code only buying position no short.




    // ===============================

    //       PARAMETRES

    // ===============================

    DEFPARAM CumulateOrders = False

    DEFPARAM PreLoadBars = 1000


    capitalPerTrade = 1000

    tradeCount = 0

    positionSize = 0


    // ===============================

    //       VARIABLES

    // ===============================

    atrValue = 0

    emaShort = 0

    rsiValue = 0

    volumeAvg = 0

    vwapValue = 0

    atrMultiplier = 0

    trailATRMultiplier = 1

    currentHour = 0

    hourStart1 = 9.5

    hourEnd1 = 11.5

    hourStart2 = 14

    hourEnd2 = 16

    maxTradesPerDay = 0

    inTradingHours = 0

    longCondition = 0

    liquidCondition = 0


    // ===============================

    //       INDICATEURS

    // ===============================

    atrValue = ATR[14](high, low, close)

    emaShort = EMA[9](close)

    rsiValue = RSI[14](close)

    volumeAvg = SMA[20](volume)

    vwapValue = VWAP[0]


    // ===============================

    //       FILTRE LIQUIDITE

    // ===============================

    liquidCondition = IFF(volumeAvg >= 500000, 1, 0)


    // ===============================

    //       HORAIRES US

    // ===============================

    currentHour = HOUR + MINUTE / 60

    inTradingHours = IFF(((currentHour >= hourStart1) AND (currentHour <= hourEnd1)) OR ((currentHour >= hourStart2) AND (currentHour <= hourEnd2)), 1, 0)


    // ===============================

    //    LIMITE DYNAMIQUE TRADES

    // ===============================

    IF atrValue < 1 THEN

      maxTradesPerDay = 2

    ELSIF atrValue < 2 THEN

      maxTradesPerDay = 3

    ELSE

      maxTradesPerDay = 5

    ENDIF


    // ===============================

    //     TAILLE POSITION

    // ===============================

    positionSize = FLOOR(capitalPerTrade / close)

    IF positionSize < 1 THEN

      positionSize = 1

    ENDIF


    // ===============================

    //     CONDITION LONG

    // ===============================

    longCondition = IFF(close > vwapValue AND low <= vwapValue AND close > open AND close > emaShort AND volume > volumeAvg AND rsiValue < 70 AND liquidCondition AND inTradingHours, 1, 0)


    IF longCondition = 1 AND tradeCount < maxTradesPerDay AND NOT ONMARKET THEN

      BUY positionSize SHARES AT MARKET

      tradeCount = tradeCount + 1

    ENDIF


    // ===============================

    //     STOP & TARGET ATR

    // ===============================

    IF atrValue < 1 THEN

      atrMultiplier = 2

    ELSIF atrValue < 2 THEN

      atrMultiplier = 2.5

    ELSE

      atrMultiplier = 3

    ENDIF


    SET STOP atrValue

    SET TARGET atrValue * atrMultiplier


    // ===============================

    //     BREAK EVEN

    // ===============================

    IF ONMARKET AND (close – ENTRYPRICE) >= (atrValue / 2) THEN

      MODIFY STOP ENTRYPRICE

    ENDIF


    // ===============================

    //     TRAILING STOP

    // ===============================

    IF ONMARKET AND (close – ENTRYPRICE) >= atrValue THEN

      MODIFY STOP (close – atrValue * trailATRMultiplier)

    ENDIF

    #258433 quote
    Nicolas
    Keymaster
    Master

    Please next time open a new topic rather than replying to an existing one not linked to your query.


    This code is made by AI and needs a lot of recoding. We’ll look at fix it as soon as possible.

    #258434 quote
    jereco273
    Participant
    New

    Yes , I had written one previously and I ask AI to make it correct but it’s seems with AI it’s still wrong

    #258435 quote
    jereco273
    Participant
    New

    I waiting for your reply thanks for your help

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

ProOrder: error on long only strategy with ATR and RSI


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
jereco273 @jereco273 Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by jereco273
3 hours, 3 minutes ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/23/2026
Status: Active
Attachments: No files
Logo Logo
Loading...