- Joined
- 15 May 2016
- Posts
- 33
- Reactions
- 0
Hello,
why varset is not assigning value right way or Is there any other issue?
when i do manually assign m2, it does work
m2 represent 2 number under candle hence I can plot _m line
When i try to do same stuff with loop, I get error m2 not initiated
but I've initiated it with varset as below
VarSet( "M" + i, TimeFrameExpand( up, i*in1Minute , expandPoint ) );
// Isn't M2 = TimeFrameExpand( up, 2*in1Minute , expandPoint ); ?
BELOW CODE IS WORKING FINE
Code:
BELOW CODE IS NOT WORKING FINE , SAME UPPER STUFF TRIED WITH LOOP
Why is this happening?
why varset is not assigning value right way or Is there any other issue?
when i do manually assign m2, it does work
m2 represent 2 number under candle hence I can plot _m line
When i try to do same stuff with loop, I get error m2 not initiated
but I've initiated it with varset as below
VarSet( "M" + i, TimeFrameExpand( up, i*in1Minute , expandPoint ) );
// Isn't M2 = TimeFrameExpand( up, 2*in1Minute , expandPoint ); ?
BELOW CODE IS WORKING FINE
Code:
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;
M2 = TimeFrameExpand( up, 2*in1Minute , expandPoint );
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="#FF0000"]if (m2[b])
PlotText( "_m" , b, L[ b ]-1-dist[1], colorgold );
}[/COLOR]
BELOW CODE IS NOT WORKING FINE , SAME UPPER STUFF TRIED WITH LOOP
Code:
Plot( C, ""+Interval(2), styleCandle );
for( i = 1; i < 3; i++ )
{
TimeframeSet( i*in1Minute );
up = C > O;
TimeframeRestore();
[B][COLOR="#FF0000"][SIZE=4]VarSet( "M" + i, TimeFrameExpand( up, i*in1Minute , expandPoint ) );
// Isn't M2 = TimeFrameExpand( up, 2*in1Minute , expandPoint ); ?[/SIZE][/COLOR][/B]
M = VarGet( "M" + i );
for( b = 0; b < BarCount; b++ )
{
if(M[b] ) PlotText(" "+(i), b, L[b]-1-(i), colorRed);
[COLOR="#FF0000"]if (M2[b])
{
PlotText( "" , b, y[ b ], colorRed );
}
[/COLOR]
}
}
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
Why is this happening?