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

[amibroker] How to Code - after daily profit target reached, no more trades for the day



PureBytes Links

Trading Reference Links

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




Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/