Need your help in multitimeframe

#52
Hi,
when i do manually,
When there is 2 number under candle I can plot _m line
When i try to same stuff with loop, I get error m2 not initiated
and I tried to initiated with varset
VarSet( "M" + i, TimeFrameExpand( up, i*in1Minute , expandPoint ) );
// Doesn't M2 = TimeFrameExpand( up, 2*in1Minute , expandPoint );



Code:
Plot( C, ""+Interval(2), styleCandle );
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
dt = DateTime();
SetBarsRequired( -2, -2 );
expandmode=expandPoint;

    TimeframeSet( in1Minute );   //  TimeframeSet(i * in1Minute);    
    up = C > O;
    M1 = TimeFrameExpand( up, in1Minute , expandPoint ); 
    TimeframeRestore();
 
    TimeframeSet( 2*in1Minute );
     up = C > O; 
[B]    M2 = TimeFrameExpand( up, 2*in1Minute , expandPoint );
[/B]    TimeframeRestore();
     
     dist = 0.1*ATR(1);
    for( b = 0; b < BarCount; b++ )
{
//------  yellow is the Invertedhammer  with NO space
if( m1[b] ) PlotText( "1" , b, L[ b ]-1-dist[1], colorRed );  
if( m2[b] ) PlotText( "2" , b, L[ b ]-1.4-dist[1], colorRed );
if( b > 11 )
[COLOR="Red"]if (m2[b])
PlotText( "_m" , b, L[ b ]-1-dist[1], colorgold );[/COLOR]
}

Code:
Plot( C, ""+Interval(2), styleCandle );

for( i = 1; i < 3; i++ )
{

    TimeframeSet( i*in1Minute );
    up = C > O;
    TimeframeRestore();
    
[SIZE="4"]VarSet( "M" + i, TimeFrameExpand( up, i*in1Minute , expandPoint ) );
[COLOR="red"]// Doesn't  M2  =  TimeFrameExpand( up, 2*in1Minute , expandPoint );
[/COLOR][/SIZE]M = VarGet( "M" + i );

   for( b = 0; b < BarCount; b++ )
    {
if(M[b] )   PlotText(" "+(i), b, L[b]-1-(i), colorRed);

[COLOR="red"]if (M2[b])
{
PlotText( "" , b, y[ b ], colorRed );
}
[/COLOR]

}
}
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );

 
Last edited: