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

 
artmedia70:

1. Find the fractal closest to the zero bar and memorize its time and price level in int and double variables

2. With each tick, look for the fractal closest to the zero bar. If its time is not equal to the fractal time, which was found in step 1, then...

2.1 Check its price level.

2.1.1 If it is below the fractal level in p1, then ... one action

2.1.2 If it is above the fractal level in p1, .... another action

2.2 Write the time of this fractal and its level into variables from step 1(int and double)

3. Return to point 2


Isn't it like that in my code?
 
DOCTORS:

Isn't it like that in my code?
It's not.
 
artmedia70:
it is not so


I agree that this is not a fractal condition, but on the fact of the rest?

1. I determine by the counter that this is the first fractal (z=0), assign the variable to the extremum of the condition (fractal) (f1= iLow(Null,0,3)).

2. In the other case (when z=1, so it is not the first "fractal", we compare it to the previous one (f1 > iLow(NULL,0,3) )

2.1. if the value of the previous one is larger, I assign a new value to the variable (f1= iLow(NULL,0,3) and set the counter to zero (z=0)

2.1 In case the previous value is smaller than the new one (f1 < iLow(NULL,0,3) ) I close the position.

Is it not so?

 
DOCTORS:


I agree that this is not a fractal condition, but on the fact of the rest?

1. I determine by the counter that this is the first fractal (z=0), assign the variable to the extremum of the condition (fractal) (f1= iLow(Null,0,3)).

2. In the other case (when z=1, so it is not the first "fractal", we compare it to the previous one (f1 > iLow(NULL,0,3) )

2.1. if the value of the previous one is larger, I assign a new value to the variable (f1= iLow(NULL,0,3) and set the counter to zero (z=0)

2.1 In case the previous value is smaller than the new one (f1 < iLow(NULL,0,3) ) I close the position.

Isn't it so?

Where is the time comparison between the first and second fractals ?
 
artmedia70:
Where is the time comparison of the first and second fractals ?


What for? Of course I can, but in my case, is finding a "fractal" defined by a condition (low-mi 5 bars)? And not by time ...

Again, the "z" counter is the very blocker, so that the definition of "fractal" in my case does not loop in one.

 

Help, please. I want to open a locking position when stoploss level is reached and keep it if price keeps moving in unfavourable direction. The problem is that I want to open many orders instead of one.

Here is the condition:

if (OrderType == OP_SELL && LRMA > OrderOpenPrice() + StopLoss*Point) 
 {
  OrderSend(NULL, OP_BUY, Lot, Ask, 2, 0, 0, 0, 111, 0, Green);
 }

The counter does not work for some reason. Tried everything.

 
Hello, I check history before opening an order (function isLossLastPos from Kim). But it doesn't always open in time, i.e. the order opens first and then after a few ticks the function works, but the order is already open.
 
chuvee:

Help, please. I want to open a locking position when stoploss level is reached and keep it if price keeps moving in unfavourable direction. The problem is that I want to open many orders instead of one.

Here is the condition:

The counter does not work for some reason. Tried everything.

Make a check before opening a loc: if there is no locking position, then open it.
 
T-G:
Hello, I check the history before opening an order (function isLossLastPos from Kim), but it sometimes happens not to open in time, i.e. the order opens first and then several ticks later the function takes effect, but the order is already open. Can i correct it?

The function checks the last closed position, not any position in the history. If the last closed position is losing, then this function will return true, otherwise it will return false

So check if you want to open a position in case the last position closed with a loss:

   if (isLossLastPos(Symbol(), OP_BUY, Magic)) {
      // Код открытия позиции, если последняя закрытая позиция Buy с магиком Magic убыточна
      }

or

   if (!isLossLastPos(Symbol(), OP_SELL, Magic)) {
      // Код открытия позиции, если последняя закрытая позиция Sell с магиком Magic закрыта с прибылью или в ноль
      }

Something like this ... if memory serves.

 
artmedia70:

The function checks the last closed position, not any position in the history. If the last closed position is a loss, this function will return true, otherwise it will return false

So check if you want to open a position in case the last position closed with a loss:

or

Something like this ... if memory serves

The function has no time to show it. The order opens first, a couple of ticks pass and only then the function shows the latest loss but the order has already opened.

If the movement is very strong, on one candlestick 8 orders may be opened

Reason: