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

[amibroker] Current trade profit



PureBytes Links

Trading Reference Links





HI
I am trying to code the current profit of a trade in the system 
tester. I want to plot current profit of a trade .
Problems with my code:
Does not reset to cero after each trade resumes.
Thank for your help
 
InLong = Flip( Buy, 
Sell OR Short );
InShort = Flip( Short, 
Buy OR Cover );
State = IIf( InLong, <FONT 
color=#ff00ff>1, IIf( InShort, -<FONT 
color=#ff00ff>1, 0 ));
E = Equity();
pos= IIf(state==<FONT 
color=#ff00ff>1,1,<FONT 
color=#0000ff>IIf(state==-1,<FONT 
color=#ff00ff>0,Equity()<FONT 
face="Courier New">==<FONT face="Courier New" 
color=#ff00ff>0));
Lastbar = Cum(<FONT 
color=#ff00ff>1) == LastValue( <FONT 
color=#0000ff>Cum(1) );<FONT 
color=#0000ff>
Plot(<FONT 
color=#0000ff>IIf(LastBar AND 
pos,(E-ValueWhen<FONT 
color=#000000>(Buy,E)),-(ValueWhen<FONT 
color=#000000>(Short,E) -E)),"Current 
Profit",9<FONT 
color=#000000>,2<FONT 
color=#000000>+4<FONT 
color=#000000>);






Yahoo! Groups Sponsor


  ADVERTISEMENT 









Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.