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

 
Shum_sp:

Yes, in the example, price = Bid. That's what I'm comparing. Instead of "level", something is needed. I will try this variant.


Only 1 and 2 instead of 0, will give the first or both digits after tochiki, it will no longer be XXX.00. With zero we have to try.

? If the level is not 00, for example, it needs XXX.15 or XXX.35, how can it be compared?

The function

cuts the value to a numeric value or to Digits, while it needs to select the number after the decimal point and work with it, no matter what is in the integer part.

Thank you.


Good night to you too.
 
Shum_sp:

Good day!


It means a lot to prescribe all levels.

The Expert Advisor should determine that the level is XXX.00, the user should not participate in this and specify the levels at which to work.

I cannot understand how to explain it that the current price is XXX.00

Thank you all.

//+------------------------------------------------------------------+
//|                                                       Ровное.mq4 |
//|                               Copyright 2013, Artyom A. Trishkin |
//|                       https://www.mql5.com/ru/users/artmedia70 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, Artyom A. Trishkin"
#property link      "https://www.mql5.com/ru/users/artmedia70"

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
   double a=140.20;
   double b=-123.32;
//----
   if(MathMod(a,1.0)==0) b=a; 
   Alert("140 = "+b);
//----
   return(0);
  }
//+------------------------------------------------------------------+
 
artmedia70:



Good day to you all !

Thank you. There's no "thank you" button in the corner, so I had to flub.

I was overnighting evillive's posts. Thank you


Sincerely,

 
Shum_sp:

Good day to all !

I have looked through all the EA pages, looked at codes of EAs based on pending orders,

I have not found any answer, so I have searched all pages of the Forum, read MQL tutorial and Documentation again.

Maybe I have not looked too well. Decided to ask here.

I am writing an EA based on pending orders. Previously, there was no problem with the criterion of opening a position based on indicator data (<, >, =, etc.).

But, at the moment, the system is unsyndicatorial. The criterion for opening a position is the PRICE.

Namely, at Bid equal to the PRICE level, say, ХХХ.00 or ХХХ.50 (for yen pairs), the block of criteria says that

there is a criterion to buy (or sell) and it sends us to the order opening block.

An approximate example is shown in Fig. 1, when the level is fixed and set, for example, by the user.

The question is how to specify the condition that would allow comparing the current BID with predefined but equal levels,

e.g. 140.00, 141.00, 142.00 .... namely from XXX.00

The first part of the condition is clear, e.g.

In the second part with Level, what to do.

I thank you all in advance,

Sincerely,


P.S. If this has already been discussed and I missed it, poke me please.


If I understand the question correctly, the price moves around the circular levels

for eur/usd

//+------------------------------------------------------------------+
//|                                                        level.mq4 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   double level=NormalizeDouble(Bid,2);
   if(Bid == level)
   {
    Alert(" ну вот  Bid равен level ");
   }
   
   
   Alert("level   " ,level);
   Alert("bid   ",Bid);
//----
   return(0);
  }
//+------------------------------------------------------------------+
 

I'm trying to figure out how to set the arrows in the indicators. Please tell me what is wrong in this code. The buy arrows are set, but the sell arrows are not.

#property indicator_chart_window
#property  indicator_color1 Aqua
#property  indicator_width1 1
#property  indicator_color2 Red
#property  indicator_width2 1

int otstup = 50;//отступ стрелки от свечи pips
double buy[],sell[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators

   IndicatorBuffers(2);
   SetIndexBuffer(0,buy);
   SetIndexBuffer(1,sell);
   
   SetIndexArrow(0,233);//buy
   SetIndexArrow(1,234);//sell
   
   SetIndexStyle(0,DRAW_ARROW,EMPTY,1,Aqua);
   SetIndexEmptyValue(0,0.0);
   SetIndexStyle(1,DRAW_ARROW,EMPTY,1,Red);
   SetIndexEmptyValue(1,0.0);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {

//----
        sell[1]= High[1]+otstup*Point;
    
        buy[1] = Low[1]-otstup*Point;
//----
   return(0);
  }
//+------------------------------------------------------------------+
 
khorosh:

I'm trying to figure out how to set the arrows in the indicators. Please tell me what is wrong in this code. The buy arrows are set, but the sell arrows are not.

Try
#property indicator_buffers 2
а не 
 IndicatorBuffers(2);
 хотя у меня рисует обе стрелки и так, и эдак
 
pako:


If I understand the question correctly, the price moves in round levels

for eur/usd.

As far as I understand it, he needs the EA to see the "round price" itself. For example:

140.42 - wrong.

139.54 - wrong

140.00 - required price

139.00 - target price.

That is, to make the fractional part of the price contain zeros. I gave him an example of a script, but, as I understand it, thinking is not inherent in some people...

Then it goes like this:

if(MathMod(Bid,1.0)==0) Alert("Нашли круглую цену : "+DoubleToStr(Bid,Digits));
 
artmedia70:

As far as I understand it, he needs the advisor to see the "round price" himself. For example:

140.42 - wrong.

139.54 - wrong.

140.00 - target price

139.00 - target price.

That is, to make the fractional part of the price contain zeros. I gave him an example of a script, but, as I understand it, thinking is not inherent in some people...

Then it goes like this:



Nah, he then thought about it and decided that 140.15 or 140.35 is also a steep price and might be needed. The client hasn't decided what he needs just yet )))
 
evillive:
Nah, he then thought about it and decided that 140.15 or 140.35 is also a steep price and might be needed. The client hasn't decided what he needs just yet )))

Well... when he finally decides what he wants then let him start thinking ...
 
evillive:
Try
Thank you.