stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

TradeChart
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=4389
Page 1 of 9
Author:  renexxxx [ Sat Aug 15, 2015 8:53 am ]
Post subject:  TradeChart

I have created a graphical counter part for the TradeReport indicator. It has similar parameters as TradeReport, but rather than summing up the trade figures, it tries to figure out for an historical candle what the equity and balance were at that time. These figures are approximated, by determining which trades were open at/during that candle, and comparing the open symbol's typical price with their open price. This together with the lot size can be converted to a dollar figure. TradeChart plots these figures on a sub chart, together with some other information, like max equity, min equity and draw down etc.. Here is an example of TradeChart together with TradeReport:
Selection_096.jpg
The question that this indicator tries to answer is, "What has been the effect of trading your selected system to your account?" With the parameters MagicNumber, CommentFilter, SymbolFilter and StartDate you can select a sub set of your trades (open and closed), that represent the trades of your EA or strategy you want to analyse.

The indicator is attached below. You will need to allow DLL imports, as TradeChart uses user32.dll, to select "All History" in the History-tab.
I have not included the .mq4-file, not because it is top-secret, but because the code uses an #include file and I want to save myself from a lot of misery of telling people how to compile the code.

Hope this will be of use for someone.

Hint: Sometimes it seems as if the figures don't add up. Play with the time frames on your chart, to force Empty4 to refresh the price data.

Update: The information panel has been extended to also display the report parameters (Start Date, Magic Number etc ...) As the extended panel was/is obscuring most of the chart, I added a close button, so that you can flip the panel away. See:
Selection_098.jpg
There is a weird bug (or undocumented feature) in Empty4, such that if there is no indicator buffer line displayed (eg. due to a set of report parameters that do not result in any trade selection), mouse clicks on screen objects are not registered. To be more precise: they are registered, but the sparam (in OnChartEvent) is blank. In layman terms: if there is no line on the screen, the close button (on the info panel) doesn't work. Go figure.

Update 2016-09-05: (1) Fixed startup bug ... see this post. (2) Added the CurrencyFilter parameter à la TradeReport.

Update: 2016-09-07: Made a significant performance improvement, by 'sucking in' all the orders into an internal structure and sorting them in chronological order, before calculating the balance and UPL for each past candle.

Update: 2016-10-28: Removed a print statement that was left in by mistake for debugging. Thanks Thomas (tomele) for letting me know!

Update: 2017-05-07: A new version (TradeChart3) has been attached, that has improvements to the info-panel. See this Post for more information.

Update: 2017-05-31: There are two small changes:
  • It now takes into account the AccountCredit() -- if your br0ker uses this --, to calculate the Account Balance
  • The applied price type it uses to calculate the UPL for a candle can now be selected from a drop box. The default value is "Typical Price" (i.e. (High + Low + Close)/3 )
Author:  Tebis [ Sat Aug 15, 2015 4:23 pm ]
Post subject:  TradeChart

Rene,
thanks a lot for such gr8, valuable Tool !
cheers
Tebis
Author:  mobthehop [ Sun Aug 16, 2015 4:21 am ]
Post subject:  TradeChart

wow Rene.. what a wonder of coding - thanks a lot!
Author:  porseguro [ Sun Aug 16, 2015 6:45 pm ]
Post subject:  TradeChart

Thank you Rene, great coding
Author:  SteveHopwood [ Sun Aug 16, 2015 9:04 pm ]
Post subject:  TradeChart

There should be some interest here now.

Thanks Rene, for yet more fabulous work. :clap: :clap: :clap: :clap: :clap:

:xm:
Author:  renexxxx [ Tue Aug 18, 2015 2:35 am ]
Post subject:  TradeChart

There was a request to also display the report parameters on the info panel. Update is in Post 1
Author:  Pipologist [ Tue Aug 18, 2015 6:24 am ]
Post subject:  TradeChart

Thank you Rene for this very useful tool :good:
Author:  mobthehop [ Tue Aug 18, 2015 8:23 am ]
Post subject:  TradeChart

Rene,

all is good on all demo accounts but one.... see attached...

It is a new demo account 5000 starting capital, opened last Thursday...

The percet-gain is correct but max / min equity is /are simply impossible...

What can I provide in terms of info for you to locate the "gremlin"?

Cheers
Author:  renexxxx [ Tue Aug 18, 2015 8:34 am ]
Post subject:  TradeChart

mobthehop » Tue Aug 18, 2015 6:23 pm wrote: What can I provide in terms of info for you to locate the "gremlin"?
Did you already play with the time frames (flipping from one to the other) to get it to behave properly? If you did, I have to scratch my head a bit more...
Author:  mobthehop [ Tue Aug 18, 2015 4:02 pm ]
Post subject:  TradeChart

renee,

changing tfs is first thing that came to mind, so ....

This is a cowboy set of Dynamo.... any use if I send you the closed trade report in html or better in csv?

Cheers
All times are UTC Page 1 of 9