Hello,
I have been wrestling with TIMEFRAME for a while trying to get a particular result.
I want to use an indicator in the 5 minute timeframe called zenith and upon Updateonclose of the bar it will be equal to the HIGH in that bar plus 4 points (i.e. zenith = HIGH + 4).
I then want to BUY in any of the next 10 second bars where CLOSE is greater than or equal to zenith (i.e. IF CLOSE >= zenith THEN …).
If the 5 minute bar ends at 080459 does the 10 second bar start at 080500 so that the 10 second bars are running in sync with the 5 minute bars?
Is this possible as my attempts don’t work.
Thank you in anticipation,
Joseph
Actually all bars start on minute 00 and second 00 and end on minute 59 and second 59, so the next bar, be it 4h or 1 second, will start immediately the next second, which is second 00.
Since your setup is on a 5-minute TF, but you are working on a 10-second TF, you will have to check that both these conditions are met:
- the current MINUTE (not OpenMinute) MOD 5 is 00
- the current SECOND (not OpenSecond) is 00
Example:
IF OnMarket THEN
SELL at Market
ENDIF
IF (Second = 0) AND (Minute MOD 5 = 0) THEN
BUY At Market
ENDIF
JSParticipant
Senior
Hi @maleczek
Here’s an example with MTF…
(in this example I had the trade closed after 5 minutes)
DefParam CumulateOrders=False
TimeFrame(5 minutes, UpDateOnClose)
Zenith=High+4*pipsize
TimeFrame(Default) //TF 10 seconds
If Close>=Zenith then
Buy 1 contract at Market
EndIf
If OnMarket and BarIndex-TradeIndex>=30 then
Sell at Market
EndIf
GraphOnPrice Zenith
Thank you ‘robertogozzi’ for your in depth response and thank you ‘JS’ for putting it into context … both very helpful !