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

 
DhP:

How do I make this cycle "easier"? It takes a very long time to count.
 if(iHigh(NULL,60,i)>LOWprice && LOWprice>iLow(NULL,60,i)) if(LOWprice> bid) CountH++ else CountL++; 
 
Tell me, why do you need bars "over a year"? Why do you need bars "over a year" if you only really need data "on a certain area"? Find a tool that defines "plot size" and then use the number of bars equal to "plot size".
 
splxgf:
Yes, it's more "colourful" and correct.
 
DDFedor:
Tell me, why do you need bars "over a year"? Why do you need bars "over a year" if you only really need data "on a certain area"? Find a tool that defines "plot size" and then use the number of bars equal to "plot size".
I don't get it...
 
I don't know about beauty and correctness, but it gets rid of double call iHigh,iLow... I'm too lazy to think about it now, if you understand the logic of the code, maybe there will be other options.
 
splxgf:
I don't know about beauty and correctness, but it gets rid of double call iHigh,iLow... I'm too lazy to think about it now, if you understand the logic of the code, maybe there will be other options.


here:

          if(LOWprice> bid)if(iHigh(NULL,60,i)>LOWprice && LOWprice>iLow(NULL,60,i))CountH++;  
          if(LOWprice<=bid)if(iHigh(NULL,60,i)>LOWprice && LOWprice>iLow(NULL,60,i))CountL++;

no iHigh,iLow double call- there is an extra check if(LOWprice<=bid) - we should use else

 
splxgf:
I don't know about beauty and correctness, but it helps to avoid double iHigh,iLow... I'm too lazy to think about it now, but if I understand the logic of the code, maybe there will be other options.

For tomorrow's fresh head:

A double loop ( while and for) selects prices above and below the Bid and counts how many times the price 'penetrates' the hour bars over the year.

The price which has penetrated the most bars is the strongest resistance level.

Thus we have 2 strong levels in the 600 point range. Above and below the Bid.

 

Otherwise I would create a large array (60 kilobytes is not too much and can be sacrificed for the sake of speed) of price levels and fill it with the amount of crossings by the hour bars. It would be called once in init and with appearing of a new hour bar the necessary levels would be incremented, and in all other cases the array would be selected for the needed price with one simple cycle.

 
abolk:


if programmatically - when opening an order - there is a magik and a comment - you can encrypt the information about the specific condition under which the order is opened in the magik or comment

in general, the stop is not triggered by a condition, but when the price reaches a price level - the order can be closed by a condition

And how should we get back to the already written comment after n bars after writing it?


In general, how can I get information about the last closed order?

 
Xaoss1990:

How do I go back to a comment already written, n bars after writing it?

In general, how can I get information about the last closed order?


select the order https://docs.mql4.com/ru/trading/OrderSelect - search in a loop or select by ticket

then using the Order*() function the respective order parameter is looked up

Reason: