Buy on retest on a certain candle

Forums ProRealTime English forum ProBuilder support Buy on retest on a certain candle

  • This topic has 3 replies, 2 voices, and was last updated 2 weeks ago by avatarJS.
Viewing 4 posts - 1 through 4 (of 4 total)
  • #236823

    Hi!

    Im struggle with coding .

    I whant the code to buy after  one specific candle.

    example , the retest of the 09:15 candles low.

    How do i code that ? seams that AI dossent help either haha!

    #236826
    JS

    Hi Jimmy,

    Do you mean something like this…?

     

    #236838

    I have something like this. But it dossent take a single trade.

    DefParam CumulateOrders=False

    // Variables to store the low and high price of the first candle
    If OpenTime = 091500 then
    LowCandle = Low
    HighCandle = High
    CandleRange = HighCandle – LowCandle // Calculate the range of the 09:15 candle
    EndIf

    // Execute buy order if the current price touches or goes below the LowCandle
    // AND the time is between 09:15 and 12:00
    If Time >= 091500 and Time <= 120000 then
    If Low <= LowCandle then
    // Place buy order
    Buy 1 contract at Market

    // Assuming we’re using a platform that allows capturing the last trade price
    LastTradePrice = Close // or the appropriate function to get the entry price

    // Set stop loss at the distance of the candle range below the entry price
    SET STOP LOSS (LastTradePrice – CandleRange) // Correctly set the stop loss

    // Set take profit at the high of the 09:15 candle
    SET TARGET PROFIT (HighCandle) // Correctly set the take profit
    EndIf
    EndIf

     

    #236839
    JS
Viewing 4 posts - 1 through 4 (of 4 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login