[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 287
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
2011.03.30 08:40:21 USDCAD,M1: 3 4 4.00000000 ask=0.9729 bid=0.9725
it works like this
it works like this!
Thank you!
In general, it is time for MT developers to create a section in the documentation and explain in detail the problem and the need to use normalisation.
There is only a modest example without emphasis in the documentation for this situation:
Section "Type Approach" https://docs.mql4.com/ru/basis/types/casting
To FoxUA.
When Order 3 (Sell) is closed, that Order 1 (Buy) still semaphores that it was closed on Stop Loss and so 2 orders in a row are placed, because Total=1.
i.e. i look for a solution to this issue, i.e. what to replace total 1 to get rid of such an effect
Can you tell me if the script can open orders not only in the window of the chart to which it is attached, but also on other currency pairs, if it is properly prescribed on which other currency pairs you need to open?
maybe
maybe
//--------------------------------------------------------------------
extern double TakeProfit = 1000;
extern double Lots = 0.01;
extern double StopLoss = 500.0;
extern int MagNum = 1974;
int slip = 100;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
//::::Открытие и выставление ордеров
OrderSend("EURUSD",OP_BUY,Lots,NormalizeDouble(Ask,Digits),slip,NormalizeDouble(Bid - StopLoss*Point,Digits),NormalizeDouble(Ask + TakeProfit * Point,Digits),"CleverEA",MagNum,0,Green);
OrderSend("GBPUSD",OP_BUY,Lots,NormalizeDouble(Ask,Digits),slip,NormalizeDouble(Bid - StopLoss*Point,Digits),NormalizeDouble(Ask + TakeProfit * Point,Digits),"CleverEA",MagNum,0,Green);
OrderSend("USDJPY",OP_SELL,Lots,NormalizeDouble(Bid,Digits),slip,NormalizeDouble(Ask + StopLoss*Point,Digits),NormalizeDouble(Bid - TakeProfit * Point,Digits),"CleverEA",MagNum,0,Red);
OrderSend("USDCHF",OP_SELL,Lots,NormalizeDouble(Bid,Digits),slip,NormalizeDouble(Ask + StopLoss*Point,Digits),NormalizeDouble(Bid - TakeProfit * Point,Digits),"CleverEA",MagNum,0,Red);
return (0);
}
but this option, will it work or not?
OrderSend("EURUSD",OP_BUY,Lots,NormalizeDouble(Ask,Digits),slip,NormalizeDouble(Bid - StopLoss*Point,Digits),NormalizeDouble(Ask + TakeProfit * Point,Digits)," CleverEA",MagNum,0,Green);
but this option, will it work or not?
No, what you highlighted will be returned from the current tool. Bids, asks, digits and so on should be requested with MarketInfo explicitly specifying the tool
//--------------------------------------------------------------------
extern double TakeProfit = 1000;
extern double Lots = 0.01;
extern double StopLoss = 500.0;
extern int MagNum = 1974;
int slip = 100;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
//::::Открытие и выставление ордеров
OrderSend("EURUSD",OP_BUY,Lots,NormalizeDouble(Ask,Digits),slip,NormalizeDouble(Bid - StopLoss*Point,Digits),NormalizeDouble(Ask + TakeProfit * Point,Digits),"CleverEA",MagNum,0,Green);
OrderSend("GBPUSD",OP_BUY,Lots,NormalizeDouble(Ask,Digits),slip,NormalizeDouble(Bid - StopLoss*Point,Digits),NormalizeDouble(Ask + TakeProfit * Point,Digits),"CleverEA",MagNum,0,Green);
OrderSend("USDJPY",OP_SELL,Lots,NormalizeDouble(Bid,Digits),slip,NormalizeDouble(Ask + StopLoss*Point,Digits),NormalizeDouble(Bid - TakeProfit * Point,Digits),"CleverEA",MagNum,0,Red);
OrderSend("USDCHF",OP_SELL,Lots,NormalizeDouble(Bid,Digits),slip,NormalizeDouble(Ask + StopLoss*Point,Digits),NormalizeDouble(Bid - TakeProfit * Point,Digits),"CleverEA",MagNum,0,Red);
return (0);
}
But will this option work or not?
It won't. You have to use the MarketInfo function https://docs.mql4.com/ru/common/MarketInfo.
there are examples of your problem on the page