[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 398

 
solnce600:

I think I've done everything right .... Still doesn't open (in the tester)

No error information in the logbook either http://clip2net.com/s/5aLodh

I can't figure out - what's the matter?

We need to normalise Price.

double Price=NormalizeDouble(0.9022, Digits);
 
PapaYozh:

We need to normalise Price.

Papa! Thank you very much..... and one more little question....

I want to open an order only if

1. The distance between the opening price of candle N 30 and the maximum of candle N 1 is more than 150 p.


2. The opening time of a candleN 30 is equal to - ANY TIME, ANY DATE, but the value of minutes must be equal to 15 ( ie0:15;1:15;....23:15)

if ((High[1]-Open[30])> 1500*Point) && (??????????????????)

//open order

I wanted to create the second condition using the Time [30] function, but this function returns values not only in minutes but also in hours, days and years.

for the candle I need. The Minute( ) function also does not fit me, because it returns the value of minutes only for zero candlestick.

Please advise how best to code this point.



 
solnce600:

Papa! Thank you very much..... and one more little question....

I want to open an order only if

1. The distance between the opening price of candle N 30 and the maximum of candle N 1 is more than 150 p.


2. The opening time of a cand leN 30 is equal to - ANY TIME, ANY DATE, but the value of minutes MUST BE equal to 15 ( i.e.0:15;1:15;....23:15)

if ((High[1]-Open[30])> 1500*Point) && (??????????????????)

//open order

I wanted to create the second condition using the Time [30] function, but this function returns values not only in minutes but also in hours, days and years.

for the candle I need. The Minute( ) function also does not fit me, because it returns the value of minutes only for zero candle.

Please advise how to code it better.

https://docs.mql4.com/ru/dateandtime/TimeMinute

 
PapaYozh:

We need to normalise Price.

Normalised. Still won't open...

Although the other code opens without normalisation....

int start()
 {
 double Price=NormalizeDouble(0.9022, Digits); 
 if  ((iTime( NULL,0, 0) )== D'14.08.2000 14 00')
 if (Bid == Price)
if(NormalizeDouble (MathAbs (Bid - Price ), Digits) <= 0.0005)  
 int Ticket= OrderSend(Symbol(),OP_SELL,0.1,Bid,1,Ask+1490*Point,Ask-110*Point,"jfh",123 );
}
return(0);
 
 
solnce600:

Normalised. It still doesn't open...

Although other code opens without normalisation....

Use Print() and see which condition fails.
 
Good afternoon to all. Please take a look at this indicator. Is it even possible to make it work properly.
When the price moves downwards there is already one blue line in addition to the red one (red ones are added, see attachments). Then a change of trend, and here everything is correct - only blue.

thanks in advance


/* Decompiled deleted /*


 
solnce600:

Papa! Thank you very much..... and one more little question....

I want to open an order only if

1. The distance between the opening price of candle N 30 and the maximum of candle N 1 is more than 150 p.


2. The opening time of a cand leN 30 is equal to - ANY TIME, ANY DATE, but the value of minutes must be equal to 15 ( ie0:15;1:15;....23:15)

if ((High[1]-Open[30])> 1500*Point) && (??????????????????)

//open order

I wanted to create the second condition using the Time [30] function, but this function returns values not only in minutes but also in hours, days and years.

for the candle I need. Function Minute( ) also does not fit me, because it returns the value of minutes only for zero candle.

Please tell me the best way to code this point.

To fix (include in calculations) the time from the beginning (of ANY candle), it is convenient to use iBarShift (Symbol(), 1, oscillation point). And theOscillation point is the beginning of the bar of the period which is being tracked. In your case:

    if (iBarShift (Symbol(), 1, iOpen (Symbol(), PERIOD_M30, 0)) == 15) //что-то делаем

Having glanced at a piece of your code, I can tell that you don't think at all about what you're writing. Try to think about it (excerpt):

if((Minute( ) ==45)&&(Minute( ) <50))

...

 
TarasBY:


Having glimpsed a piece of your code, I can say that you don't think about what you're writing at all. Try to think about it (fragment):

...


Thank you for your answer. Sorry for sending your code without commentaries.

What you think makes no sense makes sense, and it works

if(Bid==Price) // if the time is equal to the opening time of the candle.a new candlestick is formed

if((Minute( ) ==45)&&(Minute( ) <50)) // if the minute value at the opening of a new candle is between 45 and 50(the thing is, some candles open at 45 min, and not exactly at 45 min. but with a delay. So I use &&(Minute( ) <50) to avoid missed candlesticks which open at 45 min. but actually open 1,2,3,4 min. later)

int Ticket=OrderSend(Symbol(),OP_BUY,0.1,Ask,1,Bid-1500*Point,Bid+150*Point, "jfh",123 );

}

return;

So the order opens at the start of each 15 or 5 or 1 minute candlestick, which technically opened at 45 minutes (+ no more than 4 minutes, i.e. with a delay).
 
solnce600:

I'm trying to make you understand a small point. A very IMPORTANT point: "what you wanted to prescribe" and "what you prescribed" are completely DIFFERENT things! If in the condition:

if((Minute( ) ==45)&&(Minute( ) <50))

Minute() == 46, then the GENERAL condition does NOT WORK!!! How about this:

if ((Minute() >= 45) && (Minute() < 50))

??? :-[

Reason: