Coding help - page 471 1...464465466467468469470471472473474475476477478...792 New comment Mladen Rakic 2015.05.14 07:49 #4701 systemfault:Hello Everyone, i need a help... i have a simple ea, but programmed for 4 digit. (For example: EUR/USD: 1,1234) How can i use my ea 5 digit? (For example: EUR/USD: 1,12345) Thanks:) simpleea.mq4 You can add this : *MathPow(10,_Digits%2) where ever you use _Point and then it will work in pips equally on 4 and 5 digit brokers ____________________ systemfault 2015.05.14 07:54 #4702 Hi mladen, Thanks for post. I do it this. int CheckForOpen() { double L = Low; double H = High; double Lots = MathRound(AccountBalance()/100)/1000; if((H-Bid>Limit*Point)) {OrderSend(Symbol(),OP_BUY,Lots,Ask,1,0,0,"",MAGICMA,0,CLR_NONE); for(int i=1; i<5; i++){OrderSend(Symbol(),OP_BUYLIMIT,MathPow(2,i)*Lots,Ask-i*Grid*Point*MathPow(10,_Digits%2),1,0,0,"",MAGICMA,0,CLR_NONE);} } if((Bid-L>Limit*Point)) {OrderSend(Symbol(),OP_SELL,Lots,Bid,1,0,0,"",MAGICMA,0,CLR_NONE); for(int j=1; j<5; j++){OrderSend(Symbol(),OP_SELLLIMIT,MathPow(2,j)*Lots,Bid+j*Grid*Point*MathPow(10,_Digits%2),1,0,0,"",MAGICMA,0,CLR_NONE);} } } its true? Any rookie question, so Broker digits Vs Symbol Any questions from newcomers Mladen Rakic 2015.05.14 07:58 #4703 systemfault:Hi mladen, Thanks for post. I do it this. int CheckForOpen() { double L = Low; double H = High; double Lots = MathRound(AccountBalance()/100)/1000; if((H-Bid>Limit*Point)) {OrderSend(Symbol(),OP_BUY,Lots,Ask,1,0,0,"",MAGICMA,0,CLR_NONE); for(int i=1; i<5; i++){OrderSend(Symbol(),OP_BUYLIMIT,MathPow(2,i)*Lots,Ask-i*Grid*Point*MathPow(10,_Digits%2),1,0,0,"",MAGICMA,0,CLR_NONE);} } if((Bid-L>Limit*Point)) {OrderSend(Symbol(),OP_SELL,Lots,Bid,1,0,0,"",MAGICMA,0,CLR_NONE); for(int j=1; j<5; j++){OrderSend(Symbol(),OP_SELLLIMIT,MathPow(2,j)*Lots,Bid+j*Grid*Point*MathPow(10,_Digits%2),1,0,0,"",MAGICMA,0,CLR_NONE);} } } its true? Yes But then also change the Grid parameter from 1500 to 150 or else it will try to set the price 1500 pips away from the Bid or Ask systemfault 2015.05.14 08:01 #4704 Im using that configuration; extern int PeriodX = 60; extern int Limit = 50; extern int Grid = 14; extern int Amount = 1; extern int LockDown = 20; How is that configuration? Mladen Rakic 2015.05.14 08:08 #4705 systemfault:Im using that configuration; extern int PeriodX = 60; extern int Limit = 50; extern int Grid = 14; extern int Amount = 1; extern int LockDown = 20; How is that configuration? It will open buy and sell limits 14 pips away from ask and bid Try it out systemfault 2015.05.14 08:15 #4706 mladen:It will open buy and sell limits 14 pips away from ask and bid Try it out i try... seems this... Files: adsz.png 35 kb Mladen Rakic 2015.05.14 08:40 #4707 systemfault: i try... seems this... As far as I see it is doing what it is intended to do systemfault 2015.05.14 08:46 #4708 mladen:As far as I see it is doing what it is intended to do Yeah mladen.. But i dont want to close the orders without profit and stoploss 14 pips Mladen Rakic 2015.05.14 08:52 #4709 systemfault:Yeah mladen.. But i dont want to close the orders without profit and stoploss 14 pips Then add take profit and stop loss too systemfault 2015.05.14 09:01 #4710 mladen:Then add take profit and stop loss too im added this code; int CheckForClose() { if(getProfit()>=Amount){CloseAll();} if(LockDown>0) { for(int TradeNumber = OrdersTotal(); TradeNumber >= 0; TradeNumber--) { if (OrderSelect(TradeNumber, SELECT_BY_POS, MODE_TRADES)&&(LockDown>0)) { int Pos=OrderType(); if((Pos==OP_BUY)&&(Bid-OrderOpenPrice()>Point*MathPow(10,_Digits%2)*LockDown)&&(OrderStopLoss() == 0)) {OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+Point,OrderTakeProfit(),0,CLR_NONE);} if((Pos==OP_SELL)&&(OrderOpenPrice()-Ask>Point*MathPow(10,_Digits%2)*LockDown)&&(OrderStopLoss() == 0)) {OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-Point,OrderTakeProfit(),0,CLR_NONE);} } } } } For example; EUR/USD order price 1.12345 sl/tp 1.12346 i want to sl/tp 1.12355 im not understanding whats going wrong? need some help with How to code? Modify an order 1...464465466467468469470471472473474475476477478...792 New comment
Hello Everyone,
i need a help... i have a simple ea, but programmed for 4 digit. (For example: EUR/USD: 1,1234)
How can i use my ea 5 digit? (For example: EUR/USD: 1,12345)
Thanks:)
simpleea.mq4You can add this :
*MathPow(10,_Digits%2)
where ever you use _Point and then it will work in pips equally on 4 and 5 digit brokers
____________________
Hi mladen,
Thanks for post.
I do it this.
int CheckForOpen()
{
double L = Low;
double H = High;
double Lots = MathRound(AccountBalance()/100)/1000;
if((H-Bid>Limit*Point))
{OrderSend(Symbol(),OP_BUY,Lots,Ask,1,0,0,"",MAGICMA,0,CLR_NONE);
for(int i=1; i<5; i++){OrderSend(Symbol(),OP_BUYLIMIT,MathPow(2,i)*Lots,Ask-i*Grid*Point*MathPow(10,_Digits%2),1,0,0,"",MAGICMA,0,CLR_NONE);}
}
if((Bid-L>Limit*Point))
{OrderSend(Symbol(),OP_SELL,Lots,Bid,1,0,0,"",MAGICMA,0,CLR_NONE);
for(int j=1; j<5; j++){OrderSend(Symbol(),OP_SELLLIMIT,MathPow(2,j)*Lots,Bid+j*Grid*Point*MathPow(10,_Digits%2),1,0,0,"",MAGICMA,0,CLR_NONE);}
}
}
its true?
Hi mladen,
Thanks for post.
I do it this.
int CheckForOpen()
{
double L = Low;
double H = High;
double Lots = MathRound(AccountBalance()/100)/1000;
if((H-Bid>Limit*Point))
{OrderSend(Symbol(),OP_BUY,Lots,Ask,1,0,0,"",MAGICMA,0,CLR_NONE);
for(int i=1; i<5; i++){OrderSend(Symbol(),OP_BUYLIMIT,MathPow(2,i)*Lots,Ask-i*Grid*Point*MathPow(10,_Digits%2),1,0,0,"",MAGICMA,0,CLR_NONE);}
}
if((Bid-L>Limit*Point))
{OrderSend(Symbol(),OP_SELL,Lots,Bid,1,0,0,"",MAGICMA,0,CLR_NONE);
for(int j=1; j<5; j++){OrderSend(Symbol(),OP_SELLLIMIT,MathPow(2,j)*Lots,Bid+j*Grid*Point*MathPow(10,_Digits%2),1,0,0,"",MAGICMA,0,CLR_NONE);}
}
}
its true?Yes
But then also change the Grid parameter from 1500 to 150 or else it will try to set the price 1500 pips away from the Bid or Ask
Im using that configuration;
extern int PeriodX = 60;
extern int Limit = 50;
extern int Grid = 14;
extern int Amount = 1;
extern int LockDown = 20;
How is that configuration?
Im using that configuration;
extern int PeriodX = 60;
extern int Limit = 50;
extern int Grid = 14;
extern int Amount = 1;
extern int LockDown = 20;
How is that configuration?It will open buy and sell limits 14 pips away from ask and bid
Try it out
It will open buy and sell limits 14 pips away from ask and bid Try it out
i try... seems this...
As far as I see it is doing what it is intended to do
As far as I see it is doing what it is intended to do
Yeah mladen..
But i dont want to close the orders without profit and stoploss 14 pips
Yeah mladen.. But i dont want to close the orders without profit and stoploss 14 pips
Then add take profit and stop loss too
Then add take profit and stop loss too
im added this code;
int CheckForClose()
{
if(getProfit()>=Amount){CloseAll();}
if(LockDown>0)
{
for(int TradeNumber = OrdersTotal(); TradeNumber >= 0; TradeNumber--)
{
if (OrderSelect(TradeNumber, SELECT_BY_POS, MODE_TRADES)&&(LockDown>0))
{ int Pos=OrderType();
if((Pos==OP_BUY)&&(Bid-OrderOpenPrice()>Point*MathPow(10,_Digits%2)*LockDown)&&(OrderStopLoss() == 0))
{OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+Point,OrderTakeProfit(),0,CLR_NONE);}
if((Pos==OP_SELL)&&(OrderOpenPrice()-Ask>Point*MathPow(10,_Digits%2)*LockDown)&&(OrderStopLoss() == 0))
{OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-Point,OrderTakeProfit(),0,CLR_NONE);}
}
}
}
}
For example; EUR/USD order price 1.12345 sl/tp 1.12346
i want to sl/tp 1.12355
im not understanding whats going wrong?