• Welcome back! Thank you for being a part of this Traders Community. Let's discuss and share :)
    Selamat datang kembali! Trimakasih telah menjadi bagian dari Komunitas Trader ini. Mari berdiskusi dan berbagi :)

Anyone please teach me how to write the below concept in mql4

ArunGowtham

New Member
Credits
0
Condition 1.
If orders total was 0 (no open order)

open an buy position at the current market price.

Condition 2.

if order total not equal to zero (buy position opened by condition 1)

1.get the buy orders open price and current price of that order

like...open price = 1.7234,,, current price= 1.7284

2. If that order goes profitable up to 50 pips then open another buy order with 2 x Lot size & the second opened order goes another 50 pips then open another buy order with 3 x lot size

3. If that order lose negative 50 pips in any of the opened orders close all the opened order



some one teah me how to get those parameters

thanks in advance
 
Condition 1:

int Total = 0;

for(int i=0; i<OrdersTotal(); i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
{
if(OrderSymbol() == Symbol() && OrderMagicNumber() == Magic)
{
if(OrderType() == OP_BUY || OrderType() == OP_SELL)
Total++;
}
}
}

double Stoploss= Ask- StopLoss*Point();
double Takeprofit= Ask+ TakeProfit*Point();

if(Total == 0)
{
int ticket = OrderSend(Symbol(),
OP_BUY ,
Lotsize,
Ask,
Slippage,
Stoploss,
Takeprofit,
Comments,
magic,
0,
clrBlue);
}
 
Condition 1:

int Total = 0;

for(int i=0; i<OrdersTotal(); i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
{
if(OrderSymbol() == Symbol() && OrderMagicNumber() == Magic)
{
if(OrderType() == OP_BUY || OrderType() == OP_SELL)
Total++;
}
}
}

double Stoploss= Ask- StopLoss*Point();
double Takeprofit= Ask+ TakeProfit*Point();

if(Total == 0)
{
int ticket = OrderSend(Symbol(),
OP_BUY ,
Lotsize,
Ask,
Slippage,
Stoploss,
Takeprofit,
Comments,
magic,
0,
clrBlue);
}


Thanks for your Time and effort sir ,,

Also need the second condition sir!!!
 
Create expert advisor need a brilliant brain because so many codes must be remembering
meanwhile, I only can use the robot that already inform the file, if create new only make me felt confuse
 
Hi, first I think I need to tell you what MQL4 is. With the help of MQL4, you can easily automate almost any of your trading ideas and ideas by creating yourself a semi-automatic assistant or a fully automatic Forex advisor. You will be able to free yourself from the routine of manual trading and, at the same time, remove from trading the influence of your psychological factor, which, in turn, has a huge impact on the final results of Forex trading. And all this thanks to the automation of Forex strategies, which you can do completely by yourself. You can learn programming in this language with the help of tutorials on YouTube, in which the authors show step by step how to do it. I found about a hundred tutorials on this language there.
 
Back
Top