coding the stay on market into my cose

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

    When back testing I have a problem that i want my trade to stay on for at least one bar before it sells I have two programmes that I have written but dont know how to add the code or where inside the code to place it. Any help would be amazing, I have attached the robots below,

    1DAX_ATR_trender_5.itf
    #10490 quote
    Nicolas
    Keymaster
    Master

    Are you talking about trade closure made my stoploss/takeprofit or made by your code’s conditions?

    #10505 quote
    pcorbeij
    Participant
    New

    the stoploss/take profit

    #10516 quote
    Nicolas
    Keymaster
    Master

    You can set your stoploss/takeprofit to 0 if your trade is less than 3 bars old (for example):

    IF ONMARKET AND (BarIndex - TradeIndex(1)) >= 3 THEN
     SET TARGET PPROFIT 20
     SET STOP PLOSS 20
    ELSE
     SET TARGET PPROFIT 0
     SET STOP PLOSS 0
    ENDIF
    

    Because PROFIT and LOSS must be set within the first bar, so you need to invalidate them before changing them (when it’s 3 bars old in this example).

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

coding the stay on market into my cose


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
pcorbeij @pcorbeij Participant
Summary

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

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