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

 

I have the following question.

Let's say we have 4 arrows in a row that point upwards.

CrossUp[i]=Low[i] - Range*0.75;

The question is. How and what should be substituted in the condition. So that only 1 was an arrow. What is the first, how to set the condition. So that the previous result is checked?
 
ALXIMIKS:

May I ask why?

it is forbidden to edit decompiles?

By registering at MQL4.com you agree to the following rules:

  1. When communicating on this site be courteous. Comments that offend or insult other visitors are forbidden.
  2. Any discussions about banks, brokers, and other financial institutions are prohibited. Such posts are subject to deletion.
  3. The site forbids any form of public displays of personal relationships between the participants.
  4. Any use of obscene expressions is forbidden.
  5. Adverts, spam, and flooding are prohibited.
  6. Repeated violations of the rules, ignoring the comments of the moderator, and even more - openly disrespectful to the Administration of an online resource, leads to blocking the account ("ban").
  7. The site administration has the right to make any changes to the rules that they deem necessary.

Since when is decompile a foul language?

There was already a precedent. A man was banned for posting a link to a picture and website with a commercial indicator (he asked me something about using it in an EA). I was banned for helping this man and my righteous indignation at the warning given to me - I allegedly interfered with the moderator. Although I, as well as you, asked to show the rules, which recorded my violation. So here, even referring to the rules is considered rebellion and bickering. Beware. Especially since after the massacre, all of our posts were cleaned up by the moderator and ... he's on the take...
 
Zolotai:

I have the following question.

Let's say we have 4 arrows in a row that point upwards.

CrossUp[i]=Low[i] - Range*0.75;

The question is. How and what should be substituted in the condition. In order that only 1 was an arrow. What is the first, how to set the condition. We should check the previous result.
Is it coming from the indicator or from the Expert Advisor? There is a difference. In general, to avoid drawing the arrow, we should check the previous adjacent bar in the indicator and if it has a non-zero or non-blank value, it means that the arrow on the adjacent bar already exists and we should not add the value to the current bar buffer. For an EA, if the previous adjacent bar already contains a crossing fact in the same direction as the current one and the arrow already marks this fact, the crossing fact on the current bar can be not registered (if it exists) and the arrow need not be displayed either.
I cannot tell you anything else about your code. If there are telepaths around, they will probably be able to understand your code to a greater extent ;)
 
artmedia70:
Is this from an indicator or from an EA? There is a difference. In general, to avoid drawing the arrow, you need to check the previous adjacent bar in the indicator and if it has a non-zero or non-empty value, it means that the arrow on the adjacent bar already exists and there is no need to enter the value into the current bar buffer. For an EA, if the previous adjacent bar already contains a crossing fact in the same direction as the current one and the arrow already marks this fact, the crossing fact on the current bar can be not registered (if it exists) and the arrow need not be displayed either.
I cannot tell you anything else about your code. If there are telepaths around, they will probably be able to understand your code to a greater extent ;)

It's no use. Flags should be used
 
Vinin:

It is useless. Flags should be used.

Well... flags are not flags. Why do you say that? I wouldn't bother with flags at all. You can always look at the chart to see if there was a cross on the last candle, if there was a cross on this candle. No? That's for the EA. It's the same for the turkey. There is a crossover... look at the past value of the buffer, the one that is 1 more. If there is a non-empty/non-zero value, then - there was a signal there too. And it is marked with an arrow. So we do not draw it now.

Did I miss something?

 
artmedia70:

Well... flags are not flags. Why do you say that? I wouldn't bother with flags at all. You can always look at the chart to see if there was a cross on the last candle, if there was a cross on this candle. No? That's for the EA. It's the same for the turkey. There is a crossover... look at the past value of the buffer, the one that is 1 more. If there is a non-empty/non-zero value, then - there was a signal there too. And it is marked with an arrow. So we don't draw it now.

Did I miss something?



I forgot about the speed. You have to check before the first signal
 
Vinin:

I forgot about the speed. You have to check before the first signal.

I do not understand, is it impossible in the indicator? We check it from the depth of history to zero

if (CrossUp[i+1]>0 && CrossUp[i+1]!=EMPTY_VALUE) CrossUp[i]=Low[i] - Range*0.75;

he doesn't need the arrows next to each other. That's why there won't be any in a row. One by one, they will.

The EA is different - we look deeper into the history from zero/first bar. Exactly the same way we check for the crossing signal on the bar +1 to be checked

 
artmedia70:

I don't understand, can't you do that in the indicator? We check from the depth of history to zero

he doesn't need the arrows next to each other. That's why there won't be any in a row. One by one, they will.

The EA is different - we look deeper into the history from zero/first bar. Exactly the same way we check the crossing signal on the tested bar +1



If you need a one-bar signal, then yes, of course you should do as you wrote
 
Vinin:

Well, if you need a one bar signal, then yes, of course you have to do as you wrote
I honestly have no idea how he needs it. That's why I wrote to him about telepaths...
 

If one of the pending orders triggers, then I place another pending order in the opposite direction and double the volume, for example, if I place buy, then I place sellstop 25 pips lower than buy, and if I place sell, then I place buystop 25 pips higher. If one of the pending orders triggers, we place one more pending order in the opposite direction from the triggered order, at the price of the first open order, and if it triggers too, we again place a pending order in the opposite direction from the triggered one within 25 points, etc. Thus, all buy orders should be at one price, and all sell orders should also be at one price. If anyone understands what I have written here, please help with the code))

int A = 0;
if (OrdersTotal()==0)
   {
   A = 0;
   if ( Close[2] < Close[1])
      {
      OrderSend (Symbol(),OP_BUY,1,Ask,3,Ask-50*Point,Ask+25*Point,0,1);                 // первый вариант событий
      OrderSend (Symbol(),OP_SELLSTOP,2,Bid-25*Point,3,Bid+25*Point,Bid-50*Point,0,2);
      A=1;
      }
      
   if ( Close[2] > Close[1])
      {
      OrderSend (Symbol(),OP_SELL,1,Bid,3,Bid+50*Point,Bid-25*Point,0,1);               //второй вариант событий
      OrderSend (Symbol(),OP_BUYSTOP,2,Ask+25*Point,3,Ask-25*Point,Ask+50*Point,0,2);
      A=2;
      }
   }
//------------------------------------------------------------------------------------------------------------------+
OrderSelect(1,SELECT_BY_TICKET,MODE_TRADES);            //цена открытия первого ордера
int price = OrderOpenPrice();
//------------------------------------------------------------------------------------------------------------------+   
int sells = 0;                                                                                                                              
for (int B = 0; B < OrdersTotal(); B++)
   {
   OrderSelect (B,SELECT_BY_POS,MODE_TRADES);       //количество ордеров sell
   if (OrderType() == OP_SELL) sells++;
   }
   
int buys = 0;                                                                                                                        
for (int b = 0; b < OrdersTotal(); b++)
   {
   OrderSelect (b,SELECT_BY_POS,MODE_TRADES);       //количество ордеров buy 
   if (OrderType() == OP_BUY) buys++;
   }
int sellstops = 0;                                                                                                                              
for (int C = 0; C < OrdersTotal(); C++)
   {
   OrderSelect (C,SELECT_BY_POS,MODE_TRADES);       //количество ордеров sellstop
   if (OrderType() == OP_SELL) sellstops++;
   }

int buystops = 0;                                                                                                                        
for (int c = 0; c < OrdersTotal(); c++)
   {
   OrderSelect (c,SELECT_BY_POS,MODE_TRADES);       //количество ордеров buystop 
   if (OrderType() == OP_BUY) buystops++;
   }
//-----------------------------------------------------------------------------------------------------------------+
if (OrdersTotal()==1)
   {                                               //удаление отложенного ордера..
   OrderDelete(2);                                 //..который остался после срабатываения tp и sl
   }  
//-----------------------------------------------------------------------------------------------------------------+
if (OrdersTotal()>1 && A ==1)
   {
   if (sells == buys && buystops == 0)
      {
      OrderSend (Symbol(),OP_BUYSTOP,2,price,3,price-50*Point,price+25*Point,0,2);     //условия для первого варианта
      }
   if (buys > sells && sellstops == 0)
      {
      OrderSend (Symbol(),OP_SELLSTOP,2,price-28*Point,3,price+22*Point,price-53*Point,0,2);
      }
   }
   
if (OrdersTotal()>1 && A ==2)
   {
   if (sells == buys && sellstops == 0)
      {
      OrderSend (Symbol(),OP_SELLSTOP,1,price,3,price+50*Point,price-25*Point,0,2);     //условия для второго варианта
      }
   if (buys < sells && buystops == 0) 
      {
      OrderSend (Symbol(),OP_BUYSTOP,2,price+22*Point,3,price-28*Point,price+47*Point,0,2);
      }
   }
//-----------------------------------------------------------------------------------------------------------------+
   
   return(0);
   }
Reason: