I have a question regarding multi time-frame coding..
I will want to look for signals on my longterm timeframe 1440min and enter my trades on a 60min chart with a few rules.
I have already coded both conditions...
So the condition of the 1440min chart must be true on (CalculateOnBarClose = false
plus the condition on 60min chart with (CalculateOnBarClose = true);On the 1440min I will look for this:
if (Close[0] > EMA(EMALongterm)[0] && CrossAbove(Stochastics(StoD, StoK, StoSmooth).K, StoOverSold, 1))
if (Close[0] > SMA(MAPink)[0] && MACDColorUpDown(MACDFast, MACDSlow, 9)[0] > MACDColorUpDown(MACDFast, MACDSlow, 9).Avg[0] && Stochastics(StoD, StoK, 3).K[0] > StoOverSold)
This what I have done:
Added Add(PeriodType.Minute, 1440); under "Initialize()" in the 60min entry strategy...
Then I added the following code. (I do not know how to tell the system to take the latest value and not the close of 1440min bar... So I put "LastPrice")...

protected override void OnBarUpdate()
{
if (BarsInProgress == 1)
return;
if ("LastPrice"[0] > EMA(BarsArray[1],250)
&& Stochastics(BarsArray[1],1, 5, 0) > 20
&& (Close[0] > SMA(BarsArray[0],MAPink)[0]
&& MACDColorUpDown(BarsArray[0],MACDFast, MACDSlow, 9)[0] > MACDColorUpDown(BarsArray[0],MACDFast, MACDSlow, 9).Avg[0]
&& Stochastics(StoD, StoK, 3).K[0] > StoOverSold))
{
EnterLong();
}
}

Comment