PureBytes Links
Trading Reference Links
|
Thank you very much. I now got your point.
I have modified my code as proposed but the results are still wrong. See attached.
The column CumProfit is supposed to give the accumulated profit trade by trade .
Best Regards
Bernard Bourée
bernard@xxxx
----- Original Message -----
From: Tomasz Janeczko
To: amibroker@xxxxxxxxxxxxxxx
Sent: Wednesday, August 15, 2001 6:25 AM
Subject: Re: [amibroker] Exploration
Hello Bernard,
Cum() function calculates cumulative sum for all bars since bar 1.
If you write something like that:
CumProfit = Cum( IIF( IsEmpty( Profit ), 0, Profit )
and there are 5 days between one trade and the second trade your
single trade Profit will be added (cummulated) for those 5 bars and this is wrong.
The purpose of my code:
CumProfit = Cum( IIF( IsEmpty( Profit * sell ), 0, Profit * sell ) );
was to cumulate Profit only on bars when actual "sell" condition occured,i.e.
when the trade was closed. This is the reason why I used Profit * sell
expression - it gives you Profit value on the day when sell occurred and zero
otherwise. If you then perform cumulative sum - you will get your desired
cumulative profit.
Best regards,
Tomasz Janeczko
------------------------------------------------
AmiBroker - the comprehensive share manager
http://www.amibroker.com
----- Original Message -----
From: Bernard Bourée
To: amibroker@xxxxxxxxxxxxxxx
Sent: Tuesday, August 14, 2001 6:29 PM
Subject: Re: [amibroker] Exploration
Hi Franck and Tomasz,
Thank you very much for your help.
Franck you are right my intention was to write PProfit, but it also does not work.
Tomasz with your modification I have some results but not what I'm waiting for.
I'm looking to have in the last column the profit accumulated trade by trade.
so I have modified the code with:
CumProfit = Cum( IIF( IsEmpty( Profit ), 0, Profit ) );
But as you can see in the attached jpg, the calculated values are not correct.
What am I missing ?
Thank you very much for your help.
Bernard Bourée
bernard@xxxx
----- Original Message -----
From: Tomasz Janeczko
To: amibroker@xxxxxxxxxxxxxxx
Sent: Sunday, August 12, 2001 11:05 PM
Subject: Re: [amibroker] Exploration
Hi Bernard,
There are some small mistakes in your formula,
here comes fixed one:
buy = cross (macd(), 0);
sell = cross ( 0, macd());
buy = exrem( buy, sell);
sell = exrem (sell, buy);
position = iif(buy, 1, iif( sell, -1, 0));
buyprice = ValueWhen( buy, C, 1);
sellprice = ValueWhen( sell, C, 1);
profit = buyprice - sellprice;
PProfit = 100 * Profit / BuyPrice;
CumProfit = Cum( IIF( IsEmpty( Profit * sell ), 0, Profit * sell ) );
filter =sell;
numcolumns = 6;
column0 = position;
column0Name ="Pos.";
column1= buyprice;
column1Name = "Buy p.";
column2 = sellprice;
column2Name = "Sell P.";
column3 = profit;
column3Name = "Profit";
column4 = PProfit;
column4Name = "Profit%";
column5 = CumProfit;
column5Name = "CumProf.";
Best regards,
Tomasz Janeczko
------------------------------------------------
AmiBroker - the comprehensive share manager
http://www.amibroker.com
----- Original Message -----
From: Bernard Bourée
To: amibroker@xxxxxxxxxxxxxxx
Sent: Sunday, August 12, 2001 9:18 AM
Subject: [amibroker] Exploration
Hello
I have the following exploration :
buy = cross (macd(), 0);
sell = cross ( 0, macd());
buy = exrem( buy, sell);
sell = exrem (sell, buy);
position = iif(buy, 1, iif( sell, -1, 0));
buyprice = valuewhen( buy, C, 1);
sellprice = ValueWhen( sell, C, 1);
profit = buyprice - sellprice;
PProfit = 100 * Profit / BuyPrice;
CumProfit = Sum( Profit, BarsSince(Profit));
filter =buy or sell;
numcolumns = 6;
column0 = position;
column0Name ="Pos.";
column1= buyprice;
column1Name = "Buy p.";
column2 = sellprice;
column2Name = "Sell P.";
column3 = profit;
column3Name = "Profit";
column4 = PProfit;
column4Name = "Profit%";
column5 = CumProfit;
column5Name = "CumProf.";
Everything is OK except for the CumProfit which give 0.
The idea is to obtain in this column the cumulative profit trade bytrade.
Any idea ?
Bernard Bourée
bernard@xxxx
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Yahoo! Groups Sponsor
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
------=_NextPart_001_0149_01C12570.985BC340
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 5.50.4616.200" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Dear Tomasz,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thank you very much. I now got your
point.</FONT></DIV>
<DIV><FONT face=Arial size=2>I have modified my code as proposed but the results
are still wrong. See attached.</FONT></DIV>
<DIV><FONT face=Arial size=2>The column CumProfit is supposed to give the
accumulated profit trade by trade .</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Best Regards</FONT></DIV>
<DIV>Bernard Bourée<BR><A
href="mailto:bernard@xxxx">bernard@xxxx</A></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
Tomasz Janeczko
</DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=amibroker@xxxxxxxxxx
href="mailto:amibroker@xxxxxxxxxxxxxxx">amibroker@xxxxxxxxxxxxxxx</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, August 15, 2001 6:25
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [amibroker]
Exploration</DIV>
<DIV><BR></DIV>
<DIV><FONT face="Arial CE" size=2>Hello Bernard,</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Cum() function calculates cumulative sum for all barssince
bar 1.</FONT></DIV>
<DIV><FONT size=2>If you write something like that:</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT face="Arial CE" size=2>CumProfit = Cum( IIF( IsEmpty( Profit
), 0, Profit ) </FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>and there are 5 days between one trade and the secondtrade
your</FONT></DIV>
<DIV><FONT size=2>single trade Profit will be added (cummulated) for those 5
bars and this is wrong.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>The purpose of my code:</FONT></DIV>
<DIV><FONT size=2>CumProfit = Cum( IIF( IsEmpty( Profit * sell ), 0, Profit *
sell ) );</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>was to cumulate Profit only on bars when actual "sell"
condition occured, i.e.</FONT></DIV>
<DIV><FONT size=2>when the trade was closed. This is the reason why I used
Profit * sell </FONT></DIV>
<DIV><FONT size=2>expression - it gives you Profit value on the day when sell
occurred and zero</FONT></DIV>
<DIV><FONT size=2>otherwise. If you then perform cumulative sum - you will get
your desired</FONT></DIV>
<DIV><FONT size=2>cumulative profit.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT face="Arial CE" size=2><BR>Best regards,<BR>Tomasz
Janeczko<BR>------------------------------------------------<BR>AmiBroker-
the comprehensive share manager<BR><A
href="http://www.amibroker.com">http://www.amibroker.com</A></FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial ce">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial ce; font-color: black"><B>From:</B>
<A title=bernard@xxxx href="mailto:bernard@xxxx">Bernard
Bourée</A> </DIV>
<DIV style="FONT: 10pt arial ce"><B>To:</B> <A
title=amibroker@xxxxxxxxxxxxxxx
href="mailto:amibroker@xxxxxxxxxxxxxxx">amibroker@xxxxxxxxxxxxxxx</A></DIV>
<DIV style="FONT: 10pt arial ce"><B>Sent:</B> Tuesday, August 14, 2001 6:29
PM</DIV>
<DIV style="FONT: 10pt arial ce"><B>Subject:</B> Re: [amibroker]
Exploration</DIV>
<DIV><BR></DIV>
<DIV><FONT face=Arial size=2>Hi Franck and Tomasz,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thank you very much for your help.</FONT></DIV>
<DIV><FONT face=Arial size=2>Franck you are right my intention was to write
PProfit, but it also does not work.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Tomasz with your modification I have some
results but not what I'm waiting for.</FONT></DIV>
<DIV><FONT face=Arial size=2>I'm looking to have in the last columnthe
profit accumulated trade by trade.</FONT></DIV>
<DIV><FONT face=Arial size=2>so I have modified the code with:</FONT></DIV>
<DIV><FONT face=Arial size=2>CumProfit = Cum( IIF( IsEmpty( Profit ),
0, Profit ) );</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>But as you can see in the attached
jpg, the calculated values are not correct.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>What am I missing ?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thank you very much for your help.</DIV>
<DIV><BR></DIV></FONT>
<DIV>Bernard Bourée<BR><A
href="mailto:bernard@xxxx">bernard@xxxx</A></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=amibroker@xxxx href="mailto:amibroker@xxxx">Tomasz
Janeczko</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=amibroker@xxxxxxxxxxxxxxx
href="mailto:amibroker@xxxxxxxxxxxxxxx">amibroker@xxxxxxxxxxxxxxx</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Sunday, August 12, 2001 11:05
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [amibroker]
Exploration</DIV>
<DIV><BR></DIV>
<DIV><FONT face="Arial CE" size=2>Hi Bernard,</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>There are some small mistakes in your
formula,</FONT></DIV>
<DIV><FONT size=2>here comes fixed one:</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT face="Arial CE" size=2>buy = cross (macd(), 0);<BR>sell = cross
( 0, macd());<BR> <BR>buy = exrem( buy, sell);<BR>sell = exrem (sell,
buy);<BR> <BR>position = iif(buy, 1, iif( sell, -1, 0));<BR>buyprice
= ValueWhen( buy, C, 1);<BR>sellprice = ValueWhen( sell, C, 1);<BR>profit
= buyprice - sellprice;<BR> <BR>PProfit = 100 * Profit /
BuyPrice;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face="Arial CE" size=2>CumProfit = Cum( IIF( IsEmpty( Profit *
sell ), 0, Profit * sell ) );<BR> </FONT></DIV>
<DIV><FONT face="Arial CE" size=2>filter =sell;<BR> <BR>numcolumns =
6;<BR>column0 = position;<BR>column0Name ="Pos.";<BR>column1=
buyprice;<BR>column1Name = "Buy p.";<BR>column2 =
sellprice;<BR>column2Name = "Sell P.";<BR>column3 = profit;<BR>column3Name
= "Profit";<BR>column4 = PProfit;<BR>column4Name = "Profit%";<BR>column5 =
CumProfit;<BR>column5Name = "CumProf.";</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT face="Arial CE" size=2><BR>Best regards,<BR>Tomasz
Janeczko<BR>------------------------------------------------<BR>AmiBroker
- the comprehensive share manager<BR><A
href="http://www.amibroker.com">http://www.amibroker.com</A></FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial ce">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial ce; font-color: black"><B>From:</B>
<A title=bernard@xxxx href="mailto:bernard@xxxx">Bernard
Bourée</A> </DIV>
<DIV style="FONT: 10pt arial ce"><B>To:</B> <A
title=amibroker@xxxxxxxxxxxxxxx
href="mailto:amibroker@xxxxxxxxxxxxxxx">amibroker@xxxxxxxxxxxxxxx</A>
</DIV>
<DIV style="FONT: 10pt arial ce"><B>Sent:</B> Sunday, August 12, 2001
9:18 AM</DIV>
<DIV style="FONT: 10pt arial ce"><B>Subject:</B> [amibroker]
Exploration</DIV>
<DIV><BR></DIV>
<DIV><FONT face=Arial size=2>Hello</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I have the following exploration
:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>buy = cross (macd(), 0);<BR>sell= cross (
0, macd());</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>buy = exrem( buy, sell);<BR>sell= exrem
(sell, buy);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>position = iif(buy, 1, iif( sell, -1,
0));<BR>buyprice = valuewhen( buy, C, 1);<BR>sellprice = ValueWhen(
sell, C, 1);<BR>profit = buyprice - sellprice;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>PProfit = 100 * Profit /
BuyPrice;<BR>CumProfit = Sum( Profit, BarsSince(Profit));</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV><FONT face=Arial size=2>
<DIV><BR>filter =buy or sell;</DIV>
<DIV> </DIV>
<DIV>numcolumns = 6;<BR>column0 = position;<BR>column0Name
="Pos.";<BR>column1= buyprice;<BR>column1Name = "Buy p.";<BR>column2 =
sellprice;<BR>column2Name = "Sell P.";<BR>column3 =
profit;<BR>column3Name = "Profit";<BR>column4 = PProfit;<BR>column4Name
= "Profit%";<BR>column5 = CumProfit;<BR>column5Name =
"CumProf.";<BR></DIV>
<DIV>Everything is OK except for the CumProfit which give 0.</DIV>
<DIV>The idea is to obtain in this column the cumulative profit trade by
trade.</DIV>
<DIV> </DIV>
<DIV>Any idea ?</DIV>
<DIV> </DIV></FONT>
<DIV><FONT face=Arial size=2>Bernard Bourée<BR><A
href="mailto:bernard@xxxx">bernard@xxxx</A></FONT></DIV><BR><TT>Your
use of Yahoo! Groups is subject to the <A
href="http://docs.yahoo.com/info/terms/">Yahoo! Terms of
Service</A>.</TT> <BR></BLOCKQUOTE><BR><TT>Your use of Yahoo! Groups is
subject to the <A href="http://docs.yahoo.com/info/terms/">Yahoo! Terms of
Service</A>.</TT> <BR></BLOCKQUOTE><BR><TT>Your use of Yahoo! Groups is
subject to the <A href="http://docs.yahoo.com/info/terms/">Yahoo! Terms of
Service</A>.</TT> <BR></BLOCKQUOTE><BR><BR><TT>Your
use of Yahoo! Groups is subject to the <A
href="http://docs.yahoo.com/info/terms/">Yahoo! Terms of Service</A>.</TT>
<BR></BLOCKQUOTE></BODY></HTML>
------=_NextPart_001_0149_01C12570.985BC340--
Attachment:
jpg00025.jpg
Attachment:
Description: "Description: JPEG image"
|