| 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 |
|
||||
|
The solution to my problem was easy...this new version works just fine. Take out the OrdersTotal line and run it on a 1 min timeframe and watch your account double or bust every single day practically.
Give me a break already, i've had no formal training!!!! //+------------------------------------------------------------------+ //| OP_BUYonSMAcross.mq4 | //| Copyright © 2008 | //| Forex Facts | //+------------------------------------------------------------------+ #property copyright "Copyright © 2008" #property link "http://forexdynamics.blogspot.com/" double Lots = 0.1; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { int total, ticket; double shortSMA, longSMA; if(Bars<100) { Print("There is not enough data to analyze"); return(0); } shortSMA=iMA(NULL,0,1,0,MODE_SMA,PRICE_OPEN,0); longSMA=iMA(NULL,0,10,0,MODE_SMA,PRICE_CLOSE,0); total=OrdersTotal(); if(total<1) if (shortSMA>longSMA) { ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,0,0,0,"M inute Chart",12345,0,Silver); if (ticket>0) { if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES )) Print("Buy order opened on Minute Chart at: ",OrderOpenPrice()); } else Print("Encountered Error on Minute Chart ", GetLastError()); return(0); } //---- //---- return(0); } //+------------------------------------------------------------------+ ![]() |
|
|||
|
How to change alert into trading EA
Hi Guys,
How do you change an alert indicator into a trading EA? I've tried changing the command Alert(Symbol()+" "+Period()+" XO Long ",Bid); into OrderSend(Symbol(),OP_BUY,0.01,Ask,3,20,20,"XO-CCI",1,0,Blue); at the start I chose menu to make EA, then content of my alert indicator, i copied to this EA, then I changed the command alert to trading command as above, then i compiled. But the compiled EA is not making any trade after i tried it on 1M chart for a day. Please help. |
|
|||
|
fractal_dimension indicator draw a line with the parameter e_ramdom_line= 1.5 I want my expert the stop trading when the fdi ( fractal dimension index) is >1.5, and continue trading when fdi is < 1.5.
I am looking for help writing an icustom to handle this condition inside my ea. thanks |
|
|||
|
How work with requotes?
Hi!!
I'm writting my own EA. All seems ok in backtest but when I run it in forward I get some errors because of requotes. Curiously I've got this errors 3 times and the 3 times has been on GBPUSD (I'm testing the EA in 20 pairs). I've coded a maximum slippage of 5. I tink I get this errors even when the requote is less than 5, so I don´t understand. Here is the error message: 2008.03.05 08:15:12 EA1 GBPUSD,M15: Error opening SELL order! invalid price And the requote message: 2008.03.05 08:15:11 '5267460': requote 1.9803 / 1.9807 for open sell 0.10 GBPUSD at 1.9807 sl: 1.9957 tp: 1.9357 2008.03.05 08:15:11 '5267460': request was accepted by server 2008.03.05 08:15:11 '5267460': instant order sell 0.10 GBPUSD at 1.9807 sl: 1.9957 tp: 1.9357 So if the requote is 1.9803/1.9807 and the is trying open an order at 1.9807 and a slippage of 5 pips is accepted, why this error? Finally the piece of the code for open position: void BuscarAbrir() { int Slippage=10; int MagicNumber; string symbolo=Symbol(); if (symbolo=="GBPUSD"){MagicNumber=185258471411;} if (symbolo=="EURUSD"){MagicNumber=458555788512;} if (symbolo=="NZDUSD"){MagicNumber=129999996613;} if (symbolo=="USDCAD"){MagicNumber=123456741814;} if (symbolo=="USDCHF"){MagicNumber=111112225415;} if (symbolo=="EURCHF"){MagicNumber=128588888216;} if (symbolo=="EURJPY"){MagicNumber=745698523657;} if (symbolo=="GBPJPY"){MagicNumber=555555555228;} . . . if (anterior && (comentar != -1)) { if (Kumo == 1) Print("SELL signal"); enviar = "SELL signal"; int ticket = 0; Arko = 0; while ((ticket <= 0) && (Arko < Number)) { while (!IsTradeAllowed()) Sleep(5000); ticket = OrderSend(Symbol(),OP_SELL,LotsRisk(StopLoss),Bid, Slippage,Bid + StopLoss * Point,Bid - TakeProfit * Point,Version,MagicNumber,0,Red); if (ticket < 0) { Print("Error opening SELL order! ",ErrorDescription(GetLastError())); var_116 = "Error opening SELL order! " + ErrorDescription(GetLastError()); Arko++; } } comentar = -1; } else { if (posterior && (comentar != 1)) { if (Kumo == 1) Print("BUY signal"); enviar = "BUY signal"; ticket = 0; Arko = 0; while ((ticket <= 0) && (Arko < Number)) { while (!IsTradeAllowed()) Sleep(5000); ticket = OrderSend(Symbol(),OP_BUY,LotsRisk(StopLoss),Ask,S lippage,Ask - StopLoss * Point,Ask + TakeProfit * Point,Version,MagicNumber,0,Blue); if (ticket < 0) { Print("Error opening BUY order! ",ErrorDescription(GetLastError())); var_116 = "Error opening BUY order! " + ErrorDescription(GetLastError()); Arko++; } } comentar = 1; } } } Thanks for your help and sorry if my english is no very good. Last edited by cyberpasta; 03-05-2008 at 09:57 AM. |
|
||||
|
I believe some brokers don't allow EA's to be run by default. It might be worth checking with your broker.
Its also possible within the EA to determine if the account is a demo, take a look at the source code and see if the EA uses the function IsDemo, it may be the developer only wanted it to run on demo accounts |
|
|||
|
Quote:
|
![]() |
| 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 |