| New signals service! | |
|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
![]() |
|
|
LinkBack (1) | Thread Tools | Display Modes |
|
|||
|
Hello Everybody:
I wrote a script to close all trades including the pending orders, but was disapointed after testing it. The functions: OrderClose, and Orderdelete fail in closing the trades. By calling the GetLastError function I get the error code: 4109 which is defined in the error header file as TRADE_NOT_ALLOWED. I even tried to execute those scripts which come with the platform but with no success. I hope someone can solve the problem. Thanks, |
|
|||
|
try this
Quote:
|
|
|||
|
Quote:
So, in place of " for(int i=0;i<Total;i++) ", use " for(int i=Total-1;i>=0;i--) " |
|
|||
|
Thanks firedave for the code modification. It was a small bug which I didn't pay attention to.
Crepuscular, thank you so much for hint. I could have spent a century before figuring out the solution. Finally, I have a working code. |
|
|||
|
get max drawdown function
i would like to write a function which gets the max drawdown from trade that have been closed. i have come up with two solutions.
1. calculate the drawdown while the trade is still active. saving the number to a global variable and writing the data to file according to ticket number. MT4 would always have to be online. 2. get the drawdown by geting the highest high or lowest low from the 1 min chart. the problem here is we have to have the 1 min history for the trade. (i would use this method if i could get the 1 min bars neccessary if they werent already downloaded) I would like to come up with a nicer way of getting max drawdown. Any input is appreciated. |
|
||||
|
Quote:
What did you mean by "drawdown"? Do you mean the maximum lose one of closed trades has been made?
__________________
There is a fine line between freedom of expression and hate literature. |
|
|||
|
drawdown
What i mean by drawdown is, what is the lowest point in the trade. For example, if the trade hit the stoploss, then the stoploss would be the drawdown. Now if the trade ended up on the positive side and was -15 pips at one point then the drawdown would be 15. Lastly, if the trade close at -15 pips but was -30 at one point then the drawdown would be 30.
|
![]() |
| Bookmarks |
| Tags |
| candle time, CHinGsMAroonCLK, coders guru, expert advisor, forex, how to code, I_XO_A_H, mechanical trading, trading |
| Thread Tools | |
| Display Modes | |
|
|
LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/metatrader-programming/554-how-code.html
|
||||
| Posted By | For | Type | Date | |
| Need an experienced programmer? - Page 2 | Post #0 | Refback | 09-24-2008 07:24 AM | |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to code this? | iscuba11 | Metatrader 4 mql 4 - Development course | 1 | 08-03-2007 05:22 PM |