I am trying to create a variable to count the number of trades in a bar.
So far I have used (without success):
The issue I have is that the counter recognises a trade only on the following bar and not the same bar; i.e. intrabar. I am trading realtime and have the 'Recalculate on market position change' at broker set to yes in Autotrading tab. I am using stop/limit orders which trigger intra bar as expected.vars: tradescounter(0),MP(0);
If barssinceentry(1)<>barssinceentry(0) then tradescounter = 0;
MP=marketposition;
If ( MP <> 0 ) and (MP[1] <> MP ) then tradescounter = tradescounter+ 1;
How do I recalculate the variable if not using the 'recalculate on market position change' variable (and yes, the market position does change).
Any ideas?
Thanks.