Hello everyone,
I am trying to set trade delay for the next candle after getting buy/sell signal on a specific time.
On a daily timeframe, when I get the buy/sell signal after close crossing the HL averages I want to take position at the NEXT DAY candle at 9:25 AM and backtest accordingly. I tried to do it with Timenum() but I wasn't able to plot it properly to get my results. Can anyone tell me how do I set specific time for trade delay? Thanks in advance.
Here's my code-
/*
1.Plot Chart
2.Plot Ema on Highs and Lows
3.Plot buy/sell signals
4. Entry on specific time.
5.Apply Stoploss
6. Add Transaction cost
7. Set Trade Delay
*/
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Y-Axis Price Color", colorDefault), styleThick | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
_SECTION_BEGIN("EMAs");
Hema = EMA(H, 10);
Lema = EMA(L, 10);
Plot(Hema,"Hema",colorOrange,styleLine);
Plot(Lema,"Lema",colorYellow,styleLine);
Buy = Close > Hema;
Sell = C < Lema;
Short = Buy;
Cover = Sell;
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
Short = ExRem(Sell,Buy);
Cover = ExRem(Buy,Sell);
PlotShapes(IIf(Buy, shapeUpArrow , shapeNone), colorWhite, 0,Low, Offset=-20);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone), colorYellow, 0,High, Offset=-20);
PlotShapes(IIf(Buy, shapeUpArrow , shapeNone), colorWhite, 0,Low, Offset=-20);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone), colorYellow, 0,High, Offset=-20);
_SECTION_END();
And here's the screenshot -