OpenNew(int tck) needs a value passing to it, tck
Checkup(int seek,double profit,int type, int ticket,double tp, int tck) needs 6 values passing to it . . . how else will it get a value for seek, profit, type, etc ?
Ah I see what you have done . . . . you only declare the variables in braces after the function name if you are passing those variables to the Function . . . try this . .
void OpenNew() { int tck; // <------------------------ tck=OrderSend(Symbol(),OP_BUYSTOP, LOT, Ask+500, 30, 0, 0, MAGIC,"Order", 0, Green); OrderModify(tck,OrderOpenPrice(),OrderOpenPrice()-400*Point,OrderOpenPrice()+1000*Point,0,Green); tck=OrderSend(Symbol(),OP_SELLSTOP, LOT, Bid-500, 30, 0, 0, MAGIC,"Order", 0, Green); OrderModify(tck,OrderOpenPrice(),OrderOpenPrice()+400*Point,OrderOpenPrice()-1000*Point,0,Green); }
You also need to check your return values from your OrderSend and OrderModify and check for errors . . . very important.
I fixed the OrderSend but everything seems right into my ordermodify but obviously not! I have an error saying Invalid function parameter value on this order
I don't know where it returns me this error but still I have it and I want to fix it. maybe the stoploss is above current price or something like that.
void OpenNew() { int tck; tck=OrderSend(Symbol(),OP_BUYSTOP, LOT, Ask+500*Point, 30, 0, 0, NULL,MAGIC, 0, Green); OrderModify(tck,OrderOpenPrice(),OrderOpenPrice()-400*Point,OrderOpenPrice()+1000*Point,0,Green); tck=OrderSend(Symbol(),OP_SELLSTOP, LOT, Bid-500*Point, 30, 0, 0, NULL,MAGIC, 0, Green); OrderModify(tck,OrderOpenPrice(),OrderOpenPrice()+400*Point,OrderOpenPrice()-1000*Point,0,Green); }
I fixed the OrderSend but everything seems right into my ordermodify but obviously not! I have an error saying Invalid function parameter value on this order
I don't know where it returns me this error but still I have it and I want to fix it. maybe the stoploss is above current price or something like that.
1) use Print() or Alert() to GetLastError()
2) try OP_BUYLIMIT & OP_SELLLIMIT
3) try to send without SL & TP
I fixed the OrderSend but everything seems right into my ordermodify but obviously not! I have an error saying Invalid function parameter value on this order
I don't know where it returns me this error but still I have it and I want to fix it. maybe the stoploss is above current price or something like that.
actually it works witout returning any error I get my error at ordermodify witch is 4051 invalid function parameter
actually it works witout returning any error I get my error at ordermodify witch is 4051 invalid function parameter
I fixed the OrderSend but everything seems right into my ordermodify but obviously not! I have an error saying Invalid function parameter value on this order
OrderModify(tck,OrderOpenPrice(),OrderOpenPrice()-400*Point,OrderOpenPrice()+1000*Point,0,Green);
- You can not use OrderOpenPrice and related functions until AFTER selecting a order. Always test return codes.
int ticket = OrderSend(...) if (ticket < 0) Alert("OrderSend failed: ", GetLastError()); else if (!OrderSelect(ticket, SELECT_BY_POS)) Alert("OrderSelect failed: ", GetLastError()); else if (!OrderModify(OrderTicket()...) Alert("OrderModify failed: ", GetLastError());
400*Point is 40 pips on a 5 digit broker but 400 pips on a 4 digit broker. Adjust TP, SL, AND slippage.
//++++ These are adjusted for 5 digit brokers. int pips2points; // slippage 3 pips 3=points 30=points double pips2dbl; // Stoploss 15 pips 0.0015 0.00150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) int init(){ if (Digits % 2 == 1){ // DE30=1/JPY=3/EURUSD=5 forum.mql4.com/43064#515262 pips2dbl = Point*10; pips2points = 10; Digits.pips = 1; } else { pips2dbl = Point; pips2points = 1; Digits.pips = 0; } // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl //---- These are adjusted for 5 digit brokers.
if (OrdersTotal() < 1) OpenNew()
This checks if there are no open orders on ANY chart by ANY EA or manual trading. Check for open orders by this EA on this chart.int nOrders=0; for(pos = OrdersTotal()-1; pos >= 0 ; pos--) if ( OrderSelect(pos, SELECT_BY_POS) // Only my orders w/ && OrderMagicNumber() == magic.number // my magic number && OrderSymbol() == Symbol() // and my pair. ){ nOrders++; } if (nOrders == 0) OpenNew(); :
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
just a small error to fix and then I can keep working on this project.
error is wrong parameter count I feel kinda rusty on this programming