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!
JSParticipant
Veteran
Hi Jimmy,
Do you mean something like this…?
DefParam CumulateOrders=False
If OpenTime=091500 then
LowCandle=Low
EndIf
If Time>091500 then
If Close<=LowCandle then
Buy 1 contract at Market
EndIf
EndIf
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
JSParticipant
Veteran
If OpenTime = 091500 then
LowCandle = Low
HighCandle = High
CandleRange = (HighCandle - LowCandle)
EndIf
If Time >= 091500 and Time <= 120000 then
If Low <= LowCandle then
Buy 1 contract at Market
EndIf
Set Stop Loss CandleRange
Set Target Price HighCandle
EndIf