I want to get a signal on the 1 hour timeframe using the timeframe(1 hour) then I would like to take the trade on the 5 min timeframe(5 minute). I notice I can get the signal many times from the hourly time frame so I would only like to take 1 trade / hour. Also I either get stopped out or take profit especially if stopped out would not like to try again this hour. How can I code this? any tips
In the 1h TF add:
MyBar = Barindex
Then add this to your 5min TF:
Once TradeON = 1
If OnMarket Then
TradeON = 0
endif
If not OnMarket and MyBar <> MyBar[1] Then
TradeON = 1
Endif
I edited the above code.
Also add
And TradeON = 1
to your entry conditions.
Hey Roberto, I have a new challenge for you. I wanna try to trade 2 times per hour just to se how I fair with a few more trades. The reason could be I could use a tigheter stop to take the first wave down and the get out on the pullback and then back in. Ofc I could also use a larger stop but I still like to minimize any damage when Im going the wrong way. Do you know how?
You need to add a variable to count trades.
DEFPARAM CumulateOrders = false
TIMEFRAME(1 hour,UpdateOnClose)
Sma10 = close > average[10,0](close) //variable updated every hour
Bar1h = BarIndex //variable updated every hour
TIMEFRAME(default)
ONCE Count = 0
IF Bar1h <> Bar1h[1] THEN //at each hour change clear Count
Count = 0
ENDIF
IF Sma10 AND Count < 2 AND Not OnMarket THEN
BUY 1 CONTRACT AT MARKET
Count = Count + 1 //Tally trades opened
ENDIF
SET TARGET pPROFIT 15
SET STOP pLOSS 15