You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I believe I can confirm that for eg. Alpari Micro Account (it has to be a "live" account), you have to do OrderSend with zero SL and TP and then straightaway afterwards, modify the order with the required SL and TP to get it to work. I do an OrderSelect straight after so that I can use OrderOpenPrice() as the open price in the OrderModify parameter list.
That's what I changed in my code and it seems to work now.
I think I had the same problem with Axis trader so maybe I'll try it on there again some time.
The only other thing I did was make sure that when I sent the OrderSend, there was a magic number not zero on it.
Good luck to all.
>>I believe I can confirm that for eg. Alpari Micro Account (it has to be a "live" account), you have to do OrderSend with zero SL and TP I believe I can confirm that for eg. Alpari Micro Account (it has to be a "live" account), you have to do OrderSend with zero SL and TP
No, is not.
But this broker have 3/5 digits and in this case you need to multiply your TP/SL with 10.
TakeProfit = 10 so you need TakeProfit = 100;
Helo Mqlforum..could anyone plz correct the code fr me..i m nt able to take "1pip as takeprofit"
here is the code
//+------------------------------------------------------------------+
//| MY3STEA.mq4 |
//| Copyright 2016, MetaQuotes Software Corp. |
//| https://www.mql4.com |
//+------------------------------------------------------------------+
extern double LotSize=0.1;
extern double TakeProfit=1;
extern double StopLoss=0;
extern int MagicNumber=1155;
extern double TimeFrame=0;
extern int Period=25;
extern int Rsilevel=55;
extern int ADX_Period = 14;
extern double ADX_BuyLevel = 25;
extern double ADX_SellLevel = 25;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---
return(0);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
int start()
{
double RXI=iRSI(Symbol(),0,14,0,1);
double ADXMAIN=iADX(NULL,0,ADX_Period,0,MODE_MAIN,1);
double ADXPD1=iADX(NULL,0,ADX_Period,0,MODE_PLUSDI,1);
double ADXMD1=iADX(NULL,0,ADX_Period,0,MODE_MINUSDI,1);
if(RXI>Rsilevel && ADXMAIN>ADX_BuyLevel && ADXPD1 > ADX_BuyLevel )
{
int bop=OrderSend=(Symbol(),OP_BUY,LotSize,Ask,3,0,0,NULL,MagicNumber,0,Blue);
if(bop<0)
{
Print("OrderSend failed with error #",GetLastError());
}
else
{
Print("OrderSend placed successfully");
}
bool bop = OrderModify(bop,OrderOpenPrice(),Ask-StopLoss*Point(),Ask+TakeProfit*Point(),0);
prevTime = Time[0];
buyflag = 1;
sellflag = 0;
if(bop<0)
{
Print("Error in OrderModify. Error code=",GetLastError());
}
else
{
Print("Order modified successfully.");
}
if(RXI>Rsilevel && ADXMAIN>ADX_SellLevel && ADXMD1 >ADX_SellLevel)
{
int soo = OrderSend(Symbol(),OP_SELL,LotSize,Bid,3,0,0,"SELL",MagicNumber,0,Red);
if(soo<0)
{
Print("OrderSend failed with error #",GetLastError());
}
else
{
Print("OrderSend placed successfully");
}
bool soo = OrderModify(soo,OrderOpenPrice(),Bid+StopLoss*Point(),Bid-TakeProfit*Point(),0);
prevTime = Time[0];
buyflag = 0;
sellflag = 1;
if(soo<)
{
Print("Error in OrderModify. Error code=",GetLastError());
}
else
{
Print("Order modified successfully.");
}
return(0);
}
this is my contact email=<Removed>
Play video
For large amounts of code, attach it.
I believe I can confirm that for eg. Alpari Micro Account (it has to be a "live" account), you have to do OrderSend with zero SL and TP and then straightaway afterwards, modify the order with the required SL and TP to get it to work. I do an OrderSelect straight after so that I can use OrderOpenPrice() as the open price in the OrderModify parameter list.
That's what I changed in my code and it seems to work now.
I think I had the same problem with Axis trader so maybe I'll try it on there again some time.
The only other thing I did was make sure that when I sent the OrderSend, there was a magic number not zero on it.
Good luck to all.
Thanks a lot. Spent hours in futility.
Your answer saved me!