| 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 |
|
|||
|
Quote:
But this still can't open any position because there is no logic in the code for decide how to open long / short positions. |
|
|||
|
Help with this EA
Quote:
|
|
|||
|
none trading zone - code help
Hello everyone,
I trying to tweak a code but after much effort I still couldn't get it right.. if any of you guys dont mind can you have a look at this.. appreciate.. The idea is to stop the next trade if the price range is in the same zone as the previous trade. Long trade will check zone for last OPEN POSITION long trade, and short trade will check zone for last OPEN POSITION short trade. ie. if the first LONG at 1.4000, then the second LONG will only trigger if the price move out of the zone (20 pips zone) less than 1.3990 && more than 1.4010 Thanks everyone.. //+------------------------------------------------------------------------------------------------------------------------+ //| Filter for sideways market - preventing multiple trade in similar price range and create no-trade zone | //+------------------------------------------------------------------------------------------------------------------------+ extern int Zone1 = -10; // (lower zone) extern int Zone2 = 10; // (upper zone) // no trade zone between -10 and +10 from the previous trade bool CheckZone(int type) { int cnt = OrdersTotal(); for (int i=0; i < cnt; i++) { if (!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue; if (OrderSymbol() != Symbol()) continue; if (OrderMagicNumber() != Magic) continue; if (OrderType() != type) continue; if (type == OP_BUY) { if( (Bid - OrderOpenPrice()) > Zone1*Point && (Bid - OrderOpenPrice()) < Zone2*Point ) return(false); } if (type == OP_SELL) { if( (OrderOpenPrice()-Ask) > Zone1*Point && (OrderOpenPrice()-Ask) < Zone2*Point ) return(false); } } return (true); } Last edited by nash15; 12-16-2007 at 12:53 AM. |
|
|||
|
Quote:
You are selling at the Ask price, should be Bid. The Comment field should be "", not 0. 25 as SL should be Bid+25*Point. 15 as TP should be Bid-15*Point. "R ed" is not a color. |
|
||||
|
Quote:
Thank you very much for your support! But, I am still facing problems zero knowledge of MQL. Can you please copy paste the code in mq4 file and test it on demo and then tell me if it works fine. Your support will be counted as Kindest Help Michel.Best Regards, Kashif. |
![]() |
| 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 |