[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 563

 
help me write a few lines! please!

-open buy position 0.01 Euro/Dollar at current price, stop 100 pips lower, profit 100 pips higher
-place orders -if stop triggers, double lot and buy at current price (-98 pips from open price), if profit, return to initial 0.01 lot and buy at current price (+102 pips from open price)... and so on (cycle)
- only one position must be opened and two orders must be placed at a time!
 
I'm already sick and tired, can you help?

Anyway, here's the thing.

I need the last 2 troughs or the last 2 tops to be connected by lines, but projecting 5 bars further. Here's how to do it, I've been struggling for a week)))

I am attaching the Zigzag itself.

Files:
zigzag2_r_.mq4  10 kb
 
Noterday >>:
я уже задолбался, можете помочь?

Вобщем, такая фигня.

Нужно чтобы последние 2 впадины или последние 2 вершины соединились линиями, но выступали на 5 баров дальше. Вот как это сделать, уже неделю бьюсь)))

Прилагаю сам Зигзаг.


In the line properties specify the end time of the segment by 5 bars more and the final price (ordinate of the rightmost point of the segment).

How to do it? Firstly, the EA needs to know what timeframe it is. Secondly, it must know how many seconds are in each candle of this timeframe. Third, it must be able to calculate the time of the end of the segment at the right touch point of the purple line and add to it the number of seconds that corresponds to those five bars. Thus, we will obtain the final time of the segment (abscissa)

Next, for the EA to correctly draw the end of the line, we need to know the exact price of the rightmost end segment. Since we have the price of the line segment start and the price at which the segment touches the purple line, we can programmatically calculate the line equation and use it to know what price the rightmost point of the segment will be at the fifth bar in the future.

 
I'm not a programmer, I can't make such a code. By the way, I'm not talking about an EA, I'm talking about an indicator, can someone do it? If it's not too much trouble. If it's too time-consuming, don't bother...
 
Noterday >>:
я уже задолбался, можете помочь?

Вобщем, такая фигня.

Нужно чтобы последние 2 впадины или последние 2 вершины соединились линиями, но выступали на 5 баров дальше. Вот как это сделать, уже неделю бьюсь)))

Прилагаю сам Зигзаг.

Find bar numbers of last and penultimate Hai (this can be taken from ZZ buffers)

Calculate the difference in bars and read the difference in levels (i.e. get the Hai levels on these numbers of bars),

then divide the difference of levels by the difference of bars and obtain the increment angle per bar,

and then delay everything you need taking into account the obtained angle coefficient.

Time to the right of the zero bar is calculated as time=Period()/60;

and accordingly Time[0]+n* time coefficient where n is the required bar counted from zero.

With Lowe's is the same.

 

Good evening)

Can you tell me how to program the order to be closed on a certain bar? For example, an open order at the opening of 3 bars can be closed, no matter if it is a profit or loss!

 
vasovsky >>:

Добрый вечер)

подскажите как запрограмировать закрытие ордера на определенном баре? например, открытый ордер закрыть на открытии 3 бара, не важно профит или лосс!

Look for the time of the bar opening at which the order was opened like this

int j=-1;
for(int i=0;i<Bars;i++)
   {if(Time[i]-OrderOpenTime()<=Period()/60)
      {j=i;
       break;
      }
   }

Now, in the variable j, the bar number from the beginning where the order was opened is stored. We only need to check if j=2 and the order has not been closed yet (just remember, to get OrderOpenTime(), the order must first be selected using OrderSelect()).

 
What is the most market-sensitive indicator? To be able to enter a position on small TFs without delays. I am already tired to look for something worthwhile. I am tired of looking for something worthwhile.
The funny thing is, I feel that I'm walking around somewhere, but I don't have enough brains to figure it out...
Thanks...
 
artmedia70 >>:
Подскажите наиболее чувствительный к движению рынка индикатор. Чтобы можно было без запаздываний входить в позицию на малых ТФ. Уже устал искать что-либо стоящее. Иль какая ТС есть.
Самое смешное, чувствую, что хожу где-то вокруг, а мозгов не хватает понять...
Спасибо...


Is this okay? It's a pound, M1 timeframe.

And this is the M15.