[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] when i run an exploration the variable always turns up as 1



PureBytes Links

Trading Reference Links



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. 

thanks

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/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___