Hello all, below is a snippet of code. the uses a staticvar and then sets the static var into the variable "onshort" when I run an exploration, "onshort" is always set to 1 and I can't figure out why? can anyone help? it would be greatly appreciated.
for( i = 0; i < BarCount; i++ )
{
if ( Short [ i ] )
{ priceatshort = ShortPrice[ i ];
shortAdjusted[ i ] = 1;
shortPriceAdjusted[ i ] = ShortPrice[ i ];
TrailStopArrayS[ i ] = TrailingStopS[ i ];
for (j = i+delay ; j < BarCount; j++)
{ Shorton[j]=1;
TrailStopArrayS[ j ] = TrailingStopS[ j ];
if( High[ j ] >= TrailStopArrayS[ j ] )
{ Shorton[j]=0;
Cover[ j ] = 1;
CoverPrice[ j ] = TrailStopArrayS[ j ] ;
i = j;
break;
}
if (j == BarCount - 1)
{ i = BarCount; }
}
}
}
if(Shorton[BarCount-1]==0)
{StaticVarSet("onshort",0);}
else if(Shorton[BarCount-1]==1)
{StaticVarSet("onshort",1);}
>
if( IsNull( onshort)) StaticVarSet("onshort",0);
>
__._,_.___
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
__,_._,___