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

[amibroker] Help with formula


  • Date: Fri, 22 Jan 2010 21:22:35 -0500
  • From: "Anthony Faragasso" <ajf1111@xxxxxxxx>
  • Subject: [amibroker] Help with formula

PureBytes Links

Trading Reference Links



Hello,

Could someone look at this please...I can not see the error...

The cumCST should increment up to .13 but it is not happening..

 

Thank you

Anthony

 

Buy=Cross(C,EMA(C,19));

Sell=Cross(EMA(C,19),C) ;

CumCst=0.00;

poslong=0;

posshort=0;

for (i=1; i < BarCount; i++)

{

if(Buy[i])

{

poslong==1;

posshort==0;

CumCst[i]=0.10;

}

if(Sell[i])

{

poslong==0;

posshort==1;

CumCst[i]=0.10;

}

 

if(posshort)

{

if(C[i] < C[i-1])

CumCst[i] = CumCst[i-1] + 0.003;

else

CumCst[i] = CumCst[i-1];

}

if(poslong)

{

if(C[i] > C[i-1])

CumCst[i] = CumCst[i-1] + 0.003;

else

CumCst[i] = CumCst[i-1];

}

if(CumCst[i] >= 0.13)

CumCst[i] = 0.13;

}

per=19;

Smth=2/(per+1)+CumCst;

MovAvg=AMA(C,Smth);

Plot(movavg,"",colorBlue,1);

Plot(C,"",1,64);

 

PlotShapes(Buy*shapeUpArrow,colorGreen,0,L,-20);

PlotShapes(Sell* shapeDownArrow,colorRed,0,H,-20);

Title="cumulative value = "+WriteVal(Cumcst,1.3);



__._,_.___


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

__,_._,___