coding the stay on market into my cose

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #10483 quote
    pcorbeijpcorbeij
    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
    NicolasNicolas
    Keymaster
    Legend

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

    #10505 quote
    pcorbeijpcorbeij
    Participant
    New

    the stoploss/take profit

    #10516 quote
    NicolasNicolas
    Keymaster
    Legend

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

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 NicolasNicolas
10 years, 2 months ago.

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