Breakout after 5 candles

Viewing 2 posts - 16 through 17 (of 17 total)
  • Author
    Posts
  • #249069 quote
    f1_maik
    Participant
    Junior

    Hello again after a long time.

    I found this old code here. See above.

    I wanted to ask how I can set the stop below the outside candle and the take profit to the next higher high?

    Can anyone help please?

    #249252 quote
    robertogozzi
    Moderator
    Master

    There you go:

    ONCE Tally = 0
    OTD = (Barindex - TradeIndex(1) > IntradayBarIndex)
    OutSideBAR = (high > high[1]) AND (low < low[1])
    IF OutSideBAR AND Not OnMarket THEN
       Tally = 1
       Entry = high + 5 * PipSize //Entry price = HIGH + 5 pips
       SL    = low  - 1*PipSize
       TP    = high + 1*PipSize
    ENDIF
    
    IF Tally > 5 OR OnMarket OR (StrategyProfit <> StrategyProfit[1]) THEN
       Tally = 0
    ELSIF Tally[1] > 0 THEN
       Tally = Tally + 1
    ENDIF
     
    MaxShares = abs(COUNTOFPOSITION) <= 1
     
    IF Tally AND Not LongOnMarket AND MaxShares AND OTD THEN
       BUY 1 CONTRACT AT Entry STOP
       SET STOP   PRICE SL
       SET TARGET PRICE TP
    ENDIF
    
    //graph Tally
Viewing 2 posts - 16 through 17 (of 17 total)
  • You must be logged in to reply to this topic.

Breakout after 5 candles


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
f1_maik @f1_maik Participant
Summary

This topic contains 16 replies,
has 5 voices, and was last updated by robertogozzi
6 months, 2 weeks ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/13/2022
Status: Active
Attachments: 1 files
Logo Logo
Loading...