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

 

Hello all!

I had a glitch in my EA. Errors 138 and 129 were coming out. Incorrect prices.

Question: Since the EA is not a pips, it had plenty of time to open the trade, especially the price clearly passed the signal level and was there long enough, even with bid, ask corrections.

I have run it in the tester, the deal opened. How to deal with this problem and why it occurs (everything was fine before, the EA opened deals)?

I have a feeling that after the signal processing the EA froze and did not accept further signals or maybe I should have reloaded Metatrader after the recent build?

 

Good afternoon!

How (off the top of my head) to paint under the main chart line all the bottom with one colour and the top with another, if you don't mind, maybe someone has some work to do?

 
_new-rena:

Good afternoon!

How (off the top of my head) to paint under the main chart line all the bottom with one colour and the top with another, if you don't mind, maybe someone has some work to do?


On a screenshot show what you want
 
ALXIMIKS:

on a screenshot show what you want

there is a price chart - a line. Underneath it in one tone of blue, above it in white (something similar - principle)

 
ALXIMIKS:

on a screenshot show you what you want

All right, don't worry, I already did... Wait here...

 
Forexman77:

Hello all!

I had a glitch in my EA. Errors 138 and 129 were coming out. Incorrect prices.

Question: Since the EA is not a pips, it had plenty of time to open the trade, especially the price clearly passed the signal level and was there long enough, even with bid, ask corrections.

I have run it in the tester, the deal opened. How to deal with this problem and why it occurs (everything was fine before, the EA opened trades)?

I have a feeling that after the signal processing the EA froze and did not react to further signals or maybe the Metatrader should be restarted after the latest build?

Use the prices through MarketInfo(), not Ask and Bid. For example like this:

double pa=MarketInfo(Symbol(),MODE_ASK);
double pb=MarketInfo(Symbol(),MODE_BID);

In your trade orders, do not use Ask, but pa, not Bid, but pb.

You will be happy

 
artmedia70:

Use MarketInfo() instead of Ask and Bid prices. For example, like this:

And in the trade orders, substitute pa, not Ask, and pb, not Bid.

And you will be happy


And what is the difference between Ask and MarketInfo(Symbol(),MODE_ASK)?
 
evillive:
And what is the difference between Ask and MarketInfo(Symbol(),MODE_ASK)?


Ask is a variable, stored on the computer, it changes when the next calculation of the start function occurs or when refreshed.

MarketInfo(Symbol(),MODE_ASK) - is this value taken from the server or from Ask ?

 
evillive:
And what is the difference between Ask and MarketInfo(Symbol(),MODE_ASK)?
This function takes the most recent price data. I.e., when using it in functions of positions opening and orders placing, there is no need in RefreshRates(). But after receiving some errors from the server, which require waiting or updating prices, it is necessary to refresh the trade environment using RefreshRates() and send a second request.
 

Hello to all forum members.

Any advice from knowledgeable people? I have an EA that opens trades on indicator signal, how to prescribe a signal counter programmatically, i.e. after taking Take Profit or closing an order on a Trailing Stop, the EA skips the next two signals and does not open trades.

I would appreciate the help.

void CheckForOpen()
{
   int ticket, STOPLEVEL;
   double Price, SL, TP; 
   STOPLEVEL=MarketInfo(Symbol(),MODE_STOPLEVEL);
   
   
   double AO = iIchimoku (Symbol(),0,Tenkan,Kijun,Senkou,MODE_SENKOUSPANA,1); // верхняя граница облака 
   double BO = iIchimoku (Symbol(),0,Tenkan,Kijun,Senkou,MODE_SENKOUSPANB,1); // нижняя граница облака 

      
   if(Volume[0]>1) return;

   if (AO>BO) // продажа
   {
   if (Open[1]>Close[1] && Close[1] < BO && Open[1]>BO) // продажа

     {
     Price = NormalizeDouble(Bid, Digits); // округляем до нужного нам числа цифр после запятой
     if(StopLoss >= STOPLEVEL)
          if(StopLoss > 0)
      {
       SL = Price + StopLoss*Point; // вычисляем стоплос
       SL = NormalizeDouble(SL, Digits); // округляем до нужного нам числа цифр после запятой
      }
       else SL = 0;

      if(TakeProfit > 0)
      {
       TP = Price - TakeProfit*Point;
       TP = NormalizeDouble(TP, Digits); 
      }
       else TP = 0;

      { 
      ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,SL,TP,"Pattern_1",Magic,0,Red);
      return;
      }
    }
    }
Reason: