Accumulate orders- just a small beginners tip

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #10873 quote
    ElsborgtradingElsborgtrading
    Participant
    Veteran

    Hi guys, when venturing into the point where you want to add more positions to your trade automatic, please remember to set “defparam cumulateorders=true” otherwise you might use 1 hour- like me, wondering why it does not work. This is just the example from the documentation.

    defparam cumulateorders=TRUE
    
    myMACD = MACD[12,26,9](close)
    long = myMACD crosses over 0
    exit = myMACD crosses under 0
    
    //first order
    IF NOT LongOnMarket AND long THEN
    BUY 1 CONTRACTS AT MARKET
    ENDIF
    
    If LongOnMarket AND exit THEN
    SELL AT MARKET
    ENDIF
    ind=0
    //let's add another order while price continue to get higher (more than 10 points) than the last order taken with a condition of 5 bars elapsed since then
    IF BARINDEX-TRADEINDEX(1)>5 AND Close-TRADEPRICE(1)>10 AND LongOnMarket THEN
    BUY 1 CONTRACTS AT MARKET
    Ind=1
    ENDIF
    
    //trailing stop for the whole orders
    SET STOP %TRAILING 1.5
    
    Graph ind COLOURED(255,0,0) AS "condition" //red indicate if the extra orders were triggered
    
    Nicolas thanked this post
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Accumulate orders- just a small beginners tip


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 1 voice and has 0 replies.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 07/26/2016
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...