| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Margin Level Plot indicator https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=4717 |
Page 1 of 1 |
| Author: | Foreverforex [ Mon May 16, 2016 6:53 pm ] |
| Post subject: | Margin Level Plot indicator |
Hi, Having fun demoing all the latest EA developments (Grid Dancer, RnR, etc). But given my time zone, I'm sleeping during early hours of London session when things really heat up and I'd like to be able to see what was happening with my margin levels during those times. Is anyone aware of an indicator that graphs historical margin levels in a way similar to the way the great Trade Chart indicator plots out equity and balance levels? Could allow a good way to gauge how far we can push lot sizes. I've searched this forum and internet and only found margin level alert indicators, but nothing that plots a history. Thanks, FF |
|
| Author: | SteveHopwood [ Mon May 16, 2016 10:43 pm ] |
| Post subject: | Margin Level Plot indicator |
You would think there would be something, wouldn't you? Just adding my bit here in the hope that others might take notice because I have posted, and perhaps be able to help. |
|
| Author: | renexxxx [ Tue May 17, 2016 2:14 am ] |
| Post subject: | Margin Level Plot indicator |
There are two ways to do this: 1. The easy way is similar to how EquityBalancePlot now works: It stores a value for AccountBalance() and AccountEquity() in a binary file for every minute going forward, together with a datetime, and reads that file back to plot these values in a sub window. You can create a MarginLevelPlot the same way, by storing the AccountInfoDouble( ACCOUNT_MARGIN_LEVEL ) in the file. Problem is that you have to create your own history file, i.e. you can not see the historical data points from before you first started the indicator. 2. The hard way is of course how TradeChart works: it looks at the historical candles, works out which trades were open at those candles and uses the average price of that candle to see how much these trades were in a floating profit or loss. The smaller the time frame, the more accurate the figures. Similarly, it could work out the total (net) lot size that is open for a given candle and use that information together with the account leverage and the draw down for that candle to calculate an approximate margin level. Hope this helps. |
|
| Author: | Foreverforex [ Wed May 18, 2016 6:00 am ] |
| Post subject: | Margin Level Plot indicator |
That all makes sense. I'd be happy with either version, however I'm not a coder. I've had some luck copying and pasting Steve's fixes into things, but this is beyond my scope. If someone with the skills sees value in it, perhaps they'll take a stab at it. Thanks for laying out the logic of it! |
|
| Author: | renexxxx [ Wed May 18, 2016 7:02 am ] |
| Post subject: | Margin Level Plot indicator |
The attached indicator is a literal translation of the EquityBalancePlot indicator, but it only plots your margin level. Note that if you have no trades open, your margin level is considered to be 0.0. Also, be aware that your margin level can fluctuate immensely depending on the number of open trades. Similar to EquityBalancePlot it starts with an empty (history) file, so the best it can do is display a horizontal line at the current margin level. It is best put it on the M1 timeframe initially, in order to see some action. The file it creates (\MQL4\MarginLevel_<accntno>.bin) will continue to grow, for as long as you run the indicator. Therefore, on (re) initialization, it will purge the file and only keep the last DaysToKeep days worth of data. Have fun. |
|
| Author: | slimakterium [ Wed May 18, 2016 9:17 am ] |
| Post subject: | Margin Level Plot indicator |
René - merci beaucoup! this is probably the one place in the whole World Wide Web where you can find this kind a useful tool : ) I will not say anything revealing: monitoring equity and margin levels for EA's it's like guarding pulse and blood pressure marathon runner (or in a patient, etc.) thank You (not sure for my english, lots of reading, less writing) |
|
| Author: | Foreverforex [ Wed May 18, 2016 11:37 pm ] |
| Post subject: | Margin Level Plot indicator |
thanks, Rene!! will give it a go! |
|
| All times are UTC | Page 1 of 1 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|