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

[amibroker] question on i-j; in a loop



PureBytes Links

Trading Reference Links



Hello all,
So I have been studying this loop over and over again and have a problem. It is used for sigscaleout. I am not sure what i=j does in the code. I should say why it does what it does. When I remove the i=j in the code, then the chart plots multiple short signals for that short. WHen the i=j is put back in the code then only one signal is plotted. Kind of like what EXREM does. MY question is WHY????
can anyone help?? 
 
 

if ( Short [ i ]  )

    {

        priceatshort = ShortPrice[ i ];

        LowsinceShort = 0;

        lowsinceshort = Min( Low[ i ], lowsinceshort );

         shortAdjusted[ i ] = 1;

        shortPriceAdjusted[ i ] = ShortPrice[ i ];

        FirstProfitTargetArrayS[ i ] =  priceatshort - FirstProfitTargetS;

                

        for (j = i + delay; j < BarCount; j++)

        {  LowsinceShort  = Min( Low[ j ], LowsinceShort  );

            lowSinceshortArray[ j ] = lowsinceshort;

            FirstProfitTargetArrayS[ j ] =  priceatshort - FirstProfitTargetS;

                            

            if( High[ j ] >= TrailStopArrayS[ j ] )

            { Cover[ j ] = 1;

                CoverPrice[ j ] = Max( Open[ j ], TrailStopArrayS[ j ] );

             

                i = j;

                break;   }                        

       

            if( exitType == 0 AND Low[ j ]<= (priceatshort - FirstProfitTargetS) )

            {

              // first profit target hit - scale-out

                exitType = 1;

                ShortAdjustedScale[ j ] = sigScaleOut;               

                ShortPriceAdjusted[ j ] = Min( Open[ j ], (priceatshort - FirstProfitTargets) );

                        }

           

              if (j == BarCount - 1)

            { i = BarCount; }

       

        }

    }



__._,_.___


**** 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

__,_._,___