Hi I’m a beginner and I coded this from examples on the forum, the strategy buys / shorts the inside bar breakout and closes next bar open.
It seems to work properly on all timeframes except higher timeframe like my intended daily TF? Can anyone help, I would also prefer to close before weekends. Is it an issue with my time zone settings?
edit : seemed to fix it by changing buy n share at high[1] stop and low[1],
how can I close before the weekend?
Defparam cumulateorders = false
REM inside bar
harami = high[0]<high[1] and low[0]>low[1]
n=1
amplitude = high - low
if harami THEN
buy n share at high stop
endif
if harami then
sellshort n share at low stop
endif
set stop loss amplitude
IF BarIndex >= (TradeIndex ) THEN
SELL AT MARKET
EXITSHORT AT MARKET
ENDIF
Sorry I checked again my edit did not fix it.
After some more research, it looks like the error is because of sunday candle. I tried turn off display weekend data, but that doesnt fix it
how can I close before the weekend?
To close at 210000 on Friday, try …
Timeframe (1 Hour, updateonclose)
If Day = 5 and Time = 200000 Then
Sell at Market
ExitShort at Market
Endif