Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 750

 
simpleton:

Check if OrderOpenPrice() is too close to SL, and if the stops are "on the right side of the price". You can read here:

StopLoss and TakeProfit prices cannot be too close to the market. The minimum stop distance in pips can be obtained using the MarketInfo() function with the MODE_STOPLEVEL parameter. Error 130 (ERR_INVALID_STOPS) will be generated in case of erroneous or non-normalized stops.

In this case, that is, for a pending order, the "market" is its "pending open price".

I have redone it and it seems to work. Thank you.
 
Can you tell me how to find out the computer's current ip address from MT?
 
Heroix:
Can you tell me how to get the current ip address of the computer from MT?
WebRequest to http://ipecho.net/plain and read from received file. Or WinAPI.
 

Inthe strategy tester the commandMarketInfo(Symbol(),MODE_TICKVALUE) = 0(!) This happens in situations when, for example, the instrument is EURUSD and the balance currency is RUR .... and in other combinations. My understanding is that the balance currency must be the same as the name of the second currency in the currency pair. Otherwise, it returns zero value (in the strategy tester), which makes it impossible to perform tests with the desired combinations. How to solve this problem?

 
ikatsko:

Inthe strategy tester the commandMarketInfo(Symbol(),MODE_TICKVALUE) = 0(!) This happens in situations when, for example, the instrument is EURUSD and the balance currency is RUR .... and in other combinations. My understanding is that the balance currency must be the same as the name of the second currency in the currency pair. Otherwise, it returns zero value (in the strategy tester), which makes it impossible to perform tests with the desired combinations. How to solve this problem?

The highlighting is not correct! I am calculating in euros withEURUSD, GBPUSDetc. Only when turned on it may give 0 before the first data, that's why I put a conditionbefore calculations withTICKVALUE that if != 0;

In the tester,MarketInfo() may not work, so knowing the approximate price of a tick, I set it with the condition IsTesting() || IsOptimization() || IsVisualMode().

 

Please help me create owls that trade on two pairs at the same time.

If on the first pair the variable will be like this

double a = NormalizeDouble(iOpen(NULL,PERIOD_CURRENT, 0), Digits);

how will it be for the second one?

Or the code for opening a trade by the first character will be

ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Point,Ask+TakeProfit*Point,"",0,0,Green);

how the code of the second symbol will look like

 
pavlicos:

Please help me create a scoop that trades two pairs at the same time.

If on the first pair the variable will be like this

double a = NormalizeDouble(iOpen(NULL,PERIOD_CURRENT, 0), Digits);

how will it be for the second one?

Or the code for opening a trade by the first character will be

ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Point,Ask+TakeProfit*Point,"",0,0,Green);

how the code of the second symbol will look like

NULL orSymbol() means a chart pair. You can use string mySymbol = Symbol() to distinguish between them, then you can use 2 copies of EA on corresponding charts and assign different magic symbols to be sure! Good luck!
 
pavlicos:

Please help me create a owl that trades two pairs at the same time.

If on the first pair the variable will be like this

double a = NormalizeDouble(iOpen(NULL,PERIOD_CURRENT, 0), Digits);

how will it be for the second one?

Or the code for opening a trade by the first character will be

ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Point,Ask+TakeProfit*Point,"",0,0,Green);

how the code of the second symbol will look like

// в OnTick()
double open_nzdusd_CUR=GetNormalizeOpenPriceBySymbol("NZDUSD",Period(),0);    // цена открытия текущей свечи NZDUSD
double open_audusd_M15=GetNormalizeOpenPriceBySymbol("AUDUSD",PERIOD_M15,1);  // цена открытия прошлой свечи AUDUSD на M15
//+------------------------------------------------------------------+

// функция вне тела OnTick()
//+------------------------------------------------------------------+
double GetNormalizeOpenPriceBySymbol(string sy, int timeframe, int shift) {
   int digits=(int)SymbolInfoInteger(sy,SYMBOL_DIGITS);
   return(NormalizeDouble(iOpen(sy,timeframe,shift),digits));
}
//+------------------------------------------------------------------+

With the opening, here is just the concept itself:

string symbol="AUDUSD";
double ask=SymbolInfoDouble(symbol,SYMBOL_ASK);
double bid=SymbolInfoDouble(symbol,SYMBOL_BID);
double pt=SymbolInfoDouble(symbol,SYMBOL_POINT);
int spread=(int)SymbolInfoInteger(symbol,SYMBOL_SPREAD);
int digits=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
int value=(int)SymbolInfoInteger(symbol,SYMBOL_TRADE_STOPS_LEVEL);
int level=(value==0)?spread*2:value;
//---
double sl_b=(StopLoss==0)?0:NormalizeDouble(fmin(ask-StopLoss*pt,ask-(level+1)*pt),digits);
double tp_b=(TakeProfit==0)?0:NormalizeDouble(fmax(ask+TakeProfit*pt,ask+(level+1)*pt),digits);
ticket_b=OrderSend(symbol,OP_BUY,Lots,ask,3,sl_b,tp_b,"",0,0,clrGreen);
//---
double sl_s=(StopLoss==0)?0:NormalizeDouble(fmax(bid+StopLoss*pt,bid+(level+1)*pt),digits);
double tp_s=(TakeProfit==0)?0:NormalizeDouble(fmin(bid-TakeProfit*pt,bid-(level+1)*pt),digits);
ticket_s=OrderSend(symbol,OP_SELL,Lots,bid,3,sl_s,tp_s,"",0,0,clrRed);

without checking the return codes of the trade server.

 
Today the Navigator in the terminal suddenly expanded to the full width of the screen, obscuring the charts! It was always the same width as the Market Watch! Looking for and can't find how to get it back to its previous size! Help who knows how to deal with this new nuisance! Thanks!!!
 
borilunad:
Today the Navigator in the terminal suddenly expanded to the full width of the screen, obscuring the charts! It was always the same width as the Market Watch! Looking for and can't find how to get it back to its previous size! Help who knows how to deal with this new nuisance! Thank you!
Just grab the edge and shrink it down as much as you want.
Reason: