Accumulating orders after 3 pips increase

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #39510 quote
    Juan Salas
    Participant
    Master

    Hi everyone,

    Before the weekend starts, I wanted to ask anyone here how to code (with DEFPARAM Cumulateorders = true) increasing orders every 3 pips.

    Right now, I have coded it, and it open new orders every 3 pips, but start at the beginning of the next candle. Since I am working on large TFs (30 min, 1 hour), I would like to know the exact coding trick so I can open new orders in the same candlestick right after 3 pips.

    Right now is:

    IF LONGONMARKET AND Close-TRADEPRICE(1)> 3*pipsize AND MAXCONTRACTS THEN
    BUY 1 CONTRACTS AT MARKET
    ENDIF

    I understand that “AT MARKET” will open the order at the opening of next candle (regardless is long or short), but I have tried changing it with other formulas and doesn`t work.

    I would appreciate any suggestions.

    Many thanks and have a great weekend,

    Juan

    #39512 quote
    Nicolas
    Keymaster
    Master

    This is the normal behavior because your script is only read one time per bar at Close.

    You can try to put pending stop orders at +3 pips like this:

    IF LONGONMARKET AND MAXCONTRACTS THEN
     BUY 1 CONTRACTS AT TRADEPRICE(1)+3*pipsize STOP 
    ENDIF

    But be aware that 3 pips from the current Close is certainly too close to put a STOP order, it depends of instrument though… Should of course work beautifully in backtests 🙂

    manel thanked this post
    #39522 quote
    Juan Salas
    Participant
    Master

    Hi Nicolas,

    Thanks for your message. I knew it was possible because I read it before in one of your post, but I couldn’t find it.

    I am aware that 3 pips is a very short distance, but I wanted to know the coding. I am working with relatively big timeframes (30′, 1h, 4h) and I wanted the accumulation to happen within the same candlestick. In any case, depending the case I will adapt the pips and the number of orders to the right scenario.

    Thanks so much Nicolas!

    Best,

    Juan

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

Accumulating orders after 3 pips increase


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Juan Salas @juan-salas Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Juan Salas
8 years, 8 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 06/30/2017
Status: Active
Attachments: No files
Logo Logo
Loading...