Hello,

I have searched through and not found anything in relation to being 
able to code this.

I am an intraday trader, I use a simple CCI system on the DAX, 
currently I stop trading after I reach a daily profit target per 
contract of 1000 euros and a daily loss of 400 euros.  This helps me 
not to overtrade.

I want to code into AFL the above. I may trade 4 or 5 times before I 
get to either daily profit target or daily maximum loss.

Can anyone help me with this?

The following formula is one I found as an example in help for daily 
profit, but I think this formula would work on daily bars.

I would really appreciate some guidance - thanks, Sam

-----------
With regards to below code - 
Apparently pos is 1 if in long trade AND 0 otherwise 

/////CODE///////

pos = Flip( Buy, Sell ); 

////CODE//////
E = Equity();

//How rich you were :-)
Plot(Highest(E,"I should have sold",1,3);

//Your Current Drawdown:
Plot(Highest(E) - E,"Current DrawDown",4,1);

//Trade profits:
LongProfit = IIf(Sell,E - ValueWhen(Buy,E),0);
ShortProfit = IIf(Cover,ValueWhen(Short,E)-E,0);
Plot(IIf(Sell,LongProfit,0),"LProfit",8,2+4);
Plot(IIf(Cover,ShortProfit,0),"SProfit",4,2+4);

//Current Trade Profit:
Lastbar = Cum(1) == LastValue( Cum(1) );
Plot(IIf(LastBar AND pos,E-ValueWhen(Buy,E),ValueWhen(Short,E) - 
E),"Current Profit",9,2+4);

//DailyProfits:
Plot(IIf(pos,E-Ref(E,-1),Ref(E,-1)-E),"Daily Profits",7,2);

///CODE//////



I would really appreciate any help.

Thanks,
Sam


Reply via email to