1. No, Magic Number is absent in MQL2
2. See example
2. See example
For cnt=1 to TotalTrades
{
If OrderValue(cnt,VAL_TYPE)=OP_BUY and OrderValue(cnt,VAL_SYMBOL)=Symbol then
{OrdersUp=OrdersUp+1;
ProfitUp=ProfitUp+OrderValue(cnt,VAL_PROFIT);
AvereageOpenUp=AvereageOpenUp+OrderValue(cnt,VAL_OPENPRICE);
If (OrderValue(cnt,VAL_OPENPRICE)>FractalUp)and FractalUp>0 then StopFactalUp=1;
If OrderValue(cnt,VAL_OPENPRICE)>MaxBuyPrice then MaxBuyPrice=OrderValue(cnt,VAL_OPENPRICE);
PipPrice=Abs(OrderValue(cnt,VAL_PROFIT)/(Bid-OrderValue(cnt,VAL_OPENPRICE))*Point); // поделили профит по ордеру на количество пипсов, которые образовали этот профит, получили стоимость одного пипса
//Break;
};
};
3. No, it's not allowed except the call from stand alone functions.
4. No, it's impossible. Only default currency.See example
If L[1]>L[2] and L[2]<CurrentJaw and TradeUp=0 and BalanceUp=0 then
{OpenPrice=L[2]-(1+SpredDown)*Point;
If TakeProfit=0 then TakeProfitPrice=0 Else TakeProfitPrice=OpenPrice-TakeProfit*Point; // установим цель
If StopLoss=0 then StopLossValue=0 Else StopLossValue=OpenPrice+StopLoss*Point;
SetOrder(OP_SELLSTOP,Lots,OpenPrice,3,StopLossValue,TakeProfitPrice,Blue); //
};
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 was trying to convert my mql4 program to mql2. I have a few questions here.
1. Is magic use in mql2?
2. What are the way I can select my trades? OrderSelect() don't seems to be available.
3. The mql2 seems to be running in a single block of code. Is there user defined function{} avaible in mql2?
4. Can we set order to trade a specific currency other than the default currency the EA is running on.
Thank you!