I would like to set a filter from TimeFrame 4H in TimeFrame 1H.
The position should only be opened in 1H, e.g. if the EMA50 is larger than the EMA1 in 4H.
I use the call command, code:
IF Exponentialaverage [50] (close) > Exponentialaverage [1] (close) then
Long = 1
Endif
IF Exponentialaverage [50] (close) < Exponentialaverage [1] (close) then
Long = -1
Endif
return Long
And so I drag the condition from 4H to 1H.
// OnlyShort-Strategy on Dax
// Dax 1 Euro Mini
// TimeFrame 1H
// created by JohnScher
//defparam flatafter = 210000
defparam cumulateorders = false
// define starttime
TradingDayShort = Opendayofweek = 1 //or Opendayofweek = 2 or Opendayofweek = 3 or Opendayofweek = 4 or Opendayofweek = 5
TradingTimeShort = time>= 110000 // or time = 120000 ...
c = call "Timeframe"
//maincode
IF TradingDayShort and TradingTimeShort and c = -1 Then
sellshort 1 contracts at market
ENDIF
IF Shortonmarket and barindex - tradeindex >= 30 then
Exitshort at market
ENDIF
//set stop %loss 3
//set target %profit TP
// not tested
// on other major indizes
// with Saisonalpatternmultipler from Pathfinder-Systems
// with some Re-invest-Stategies
// until then
// JohnScher
a. Did I program that right?
b. Is there an easier way to program, if so, how?
It does not call the indicator on a different time frame it calls it on the same time frame that your strategy is running on.
It is probably easier to wait until Wednesday when hopefully PRT demo will have MTF to play with and then you can just put your indicator under a TIMEFRAME(4 hour) in the strategy.
I have changed the title of your topic as it did not tell us what your question actually was. 🙂