[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 65

 
sergey_r:

Hi all. Guys I have a condition to find a maximum: but within a corridor.

for (int max=1; max<1000; max++)
if (High[max+1] < High[max] && High[max] > High[max-1] && Low[max+1] < Low[max] && Low[max] > Low[max-1] &&
High[max] > low_level_s && High[max] < high_level_s) break;

it does not work.
if I remove corridor All ok:

for (int max=1; max<1000; max++)
if (High[max+1] < High[max] && High[max] > High[max-1] && Low[max+1] < Low[max] && Low[max] > Low[max-1] ) break;

What could be the problem...?

I suggest the "max_sergey_r" script.
The script is in the "scripts" folder of the terminal (e.g., C:\Program Files\ FX Trader\experts\scripts).
The script can be placed on the chart of any instrument, any timeframe.
Files:
 
Roger:
Open the indicator in two windows and set the unwanted line to the background colour.
If the line values have a different order, half of the sub-window will be a blank spot when displayed in this way. At the moment I have to display each value of the main indicator through an additional indicator with its own sub-window. Therefore, the main is loaded in the background for EVERY open sub-window of the additional indicator, hence the extra load on the processor. It is not critical, but I wanted "perfection" :)
 

5th forum // am I the only one who gets an error?

 
abolk:

5th forum // am I the only one who gets an error?


Probably yes.
 

people, help me figure out what the heck this is! My Expert Advisor is designed to put out an oplot, and if the price does not reach it, but reverses to the level of its stop, the oplot should be deleted. but on the tester sometimes an oplot is put out and immediately deleted before it even reaches the stop. What is the problem? Here is a screenshot and deletion code.

Here is the code:

     if (Bid>SL)                                                              // Если Bid>уровня стопа
      {
      for (k = OrdersTotal()-1; k >= 0; k--)
         {
         OrderSelect(k,SELECT_BY_POS, MODE_TRADES);
         if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic)
            {
            if (OrderType() == OP_BUYSTOP || OrderType() == OP_SELLSTOP)
               {
               if(OrderDelete(OrderTicket())==true)
                  {
                  Iterration--;
                  Alert ("Ордер SellStop удален.");
                  }
                }
             }
          }
       }

What is the error here?

 
vovan-gogan:

And here's the code:

What is the error here?

There is no error in the code, only logic. Bid>SL is checked and all the pending orders are deleted (where SL is taken from is not clear from the code). If something else is needed then the goal is stated step by step in understandable language.
 

I want to build an Expert Advisor for different timeframes.

I want to build an EA for different timeframes, send me a "fish".

best regards

 
splxgf:
No errors in the code, only logic errors. Bid>SL is checked and all the pending orders are deleted (where SL is taken from is not clear from the code). If something else is needed then the goal is stated step by step in understandable language.

SL is set at the level of MA20 with 3 candles backwards.
 
vovan-gogan:

people, help me figure out what the heck this is! My EA is designed to put out an oplot, and if the price does not reach it, but reverses to the level of its stop, the oplot should be deleted. but on the tester, sometimes an oplot is put out and immediately deleted before it even reaches the stop. What is the problem? Here is a screenshot and deletion code.

Here is the code:

What is the error here?


replace

if (Bid>SL)
{

at

if (Bid>SL)
{
   Print("Bid=",Bid," SL=",SL);

and see what the log says.

 
PapaYozh:


replace

to

and see what the logbook says.


What's the point? The SL level is correct. When I set the SL variable to MA20 with a shift of 3, I output the SL level through Alert and it is always at the right level. I don't know why the order is deleted before reaching the SL level.
Reason: