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

Re: [amibroker] Current trade profit



PureBytes Links

Trading Reference Links




thanks a lot Herman!!!
 
Two problems and i am trying to code 
them...but i cannot find a solution.
 
1) i would like to see current 
profit during the trade starting from zero at entry and profit/loss at 
exit.
2)I ;ve got settradedelays so this i 
will have to adjust them.
 
Can u help me...thanks
 
 
 
 
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Herman van den 
  Bergen 
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Tuesday, September 09, 2003 6:23 
  PM
  Subject: RE: [amibroker] Current trade 
  profit
  
  <FONT face=Arial color=#0000ff 
  size=2>Hello,
  <FONT face=Arial color=#0000ff 
  size=2> 
  <FONT face=Arial color=#0000ff 
  size=2>Perhaps this code helps you. It is intended to be be used with zero 
  trade delays: SetTradeDelays(0,0,0,0); I use prices instead of equities to 
  allo me to separate Lond and Short trades.
  <FONT face=Arial color=#0000ff 
  size=2> 
  Good 
  luck,
  <FONT face=Arial color=#0000ff 
  size=2>Herman.
  /<SPAN 
  class=421233620-09092003>/ Your zero delay system here 
  LE=<FONT 
  size=2>ValueWhen<FONT 
  color=#8b0000>(Buy<FONT 
  size=2>,<FONT 
  color=#ff0000>BuyPrice<FONT 
  color=#8b0000>);LX=<FONT 
  color=#0000ff>ValueWhen<FONT 
  color=#8b0000>(Sell<FONT 
  size=2>,<FONT 
  color=#ff0000>SellPrice<FONT 
  color=#8b0000>);LP=<FONT 
  color=#0000ff>IIf<FONT 
  color=#8b0000>(Sell<FONT 
  size=2>,LX-LE,<FONT 
  color=#ff00ff>0<FONT 
  color=#8b0000>);PLP=LP/LE*<FONT 
  color=#ff00ff>100;<SPAN 
  class=421233620-09092003> SE=<FONT 
  color=#0000ff>ValueWhen<FONT 
  color=#8b0000>(Short<FONT 
  size=2>,<FONT 
  color=#ff0000>ShortPrice<FONT 
  color=#8b0000>);SX=<FONT 
  color=#0000ff>ValueWhen<FONT 
  color=#8b0000>(Cover<FONT 
  size=2>,<FONT 
  color=#ff0000>CoverPrice<FONT 
  color=#8b0000>);SP=<FONT 
  color=#0000ff>IIf<FONT 
  color=#8b0000>(Cover<FONT 
  size=2>,SE-SX,<FONT 
  color=#ff00ff>0<FONT 
  color=#8b0000>);<FONT 
  color=#8b0000>PSP=SP/SE*100<FONT 
  color=#8b0000>; 
  
  // Plot profit bars<FONT 
  color=#0000ff>Plot(<FONT 
  color=#0000ff>IIf(<FONT 
  color=#0000ff>IsEmpty<FONT 
  color=#8b0000>(PLP),0<FONT 
  color=#8b0000>,PLP),"LongProfit"<FONT 
  color=#8b0000>,colorGreen<FONT 
  size=2>,2<FONT 
  color=#8b0000>|<FONT 
  color=#ff0000>styleOwnScale<FONT 
  color=#8b0000>|styleArea<FONT 
  size=2>|<FONT 
  color=#ff0000>styleNoLabel<FONT 
  color=#8b0000>,-20<FONT 
  color=#8b0000>,10<FONT 
  color=#8b0000>);Plot<FONT 
  size=2>(0<FONT 
  color=#8b0000>,"0"<FONT 
  color=#8b0000>,colorGreen<FONT 
  size=2>,1<FONT 
  color=#8b0000>|<FONT 
  color=#ff0000>styleOwnScale<FONT 
  color=#8b0000>|<FONT 
  color=#ff0000>styleNoLabel<FONT 
  color=#8b0000>,-20<FONT 
  color=#8b0000>,10<FONT 
  color=#8b0000>);Plot<FONT 
  size=2>(<FONT 
  color=#0000ff>IIf<FONT 
  color=#8b0000>(IsEmpty<FONT 
  size=2>(PSP),0<FONT 
  color=#8b0000>,PSP),"ShortProfit"<FONT 
  color=#8b0000>,4<FONT 
  color=#8b0000>,2<FONT 
  color=#8b0000>|<FONT 
  color=#ff0000>styleOwnScale<FONT 
  color=#8b0000>|styleArea<FONT 
  size=2>|<FONT 
  color=#ff0000>styleNoLabel<FONT 
  color=#8b0000>,-10<FONT 
  color=#8b0000>,20<FONT 
  color=#8b0000>);Plot<FONT 
  size=2>(0<FONT 
  color=#8b0000>,"0"<FONT 
  color=#8b0000>,colorRed<FONT 
  size=2>,1<FONT 
  color=#8b0000>|<FONT 
  color=#ff0000>styleOwnScale<FONT 
  color=#8b0000>|<FONT 
  color=#ff0000>styleNoLabel<FONT 
  color=#8b0000>,-10<FONT 
  color=#8b0000>,20<FONT 
  color=#8b0000>);
  
    <FONT face=Tahoma 
    size=2>-----Original Message-----From: emarco 
    [mailto:emarco@xxxxxxxxxxxxxxx]Sent: Tuesday, September 09, 2003 
    10:28 AMTo: amibroker@xxxxxxxxxxxxxxxCc: Anthony 
    Faragasso; walt; GrahamSubject: [amibroker] Current trade 
    profit
    
    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
     <FONT 
    size=3>
    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=#000000>(IIf<FONT 
    color=#000000>(LastBar AND pos,(E-<FONT 
    color=#0000ff>ValueWhen<FONT 
    color=#000000>(Buy,E)),-(<FONT 
    color=#0000ff>ValueWhen(Short,E) 
    -E)),"Current Profit"<FONT 
    color=#000000>,9<FONT 
    color=#000000>,2<FONT 
    color=#000000>+4<FONT 
    color=#000000>);Send BUG REPORTS 
    to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
    suggest@xxxxxxxxxxxxx-----------------------------------------Post 
    AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: 
    <A 
    href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
    group FAQ at: <A 
    href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
    Your use of Yahoo! Groups is subject to the <A 
    href="">Yahoo! Terms of Service. 
    Send 
  BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 







Yahoo! Groups Sponsor












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.