Hello, im trying to code a sytsem on timeframe 30min but i don’t want it to open more than one trade per day,
so i tried to use a multitimeframe on daily timeframe section by setting something like ” not tradeindex =0″ in the conditions of the orders because it should return the index of the bar of the last trade (therefore it is 0 if he has already opened a trade today) but it doesn’t work.
How could it be solved? Thanks
Use this variable (OTD) as an additional condition to enter a trade:
OTD = (Barindex - TradeIndex(1) > IntradayBarIndex) // IntradayBarIndex < (Barindex - TradeIndex(1)) limits the (opening) trades till 1 per day (OTD One Trade per Day)
Example:
Otd = (Barindex - TradeIndex(1) > IntradayBarIndex) // IntradayBarIndex < (Barindex - TradeIndex(1)) limits the (opening) trades till 1 per day (OTD One Trade per Day)
MyLongConditions = Not OnMarket AND close CROSSES OVER Average[10,0](close)
IF Otd AND MyLongConditions THEN
BUY 1 Contract at Market
ENDIF
SET STOP pLOSS 100
SET TARGET pPROFIT 200
Thanks Roberto it seems to work fine.
Grazie Roberto sei un idolo!