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

 

double min=Low[iLowest(NULL,PERIOD_M15,MODE_LOW,32,0)];

Good afternoon please advise

How do I record 1.30320 for EURUSD for example?

 
hoz:

Here is the trading function that opens positions:

All clear and concise. Error 130 keeps popping up in the tester, although the Expert Advisor works, but error 130 keeps popping up. What is the reason for that?

This function uses position opening functions, here they are:

I thought it had something to do with stop level, I added check, but it's not the same. I removed it for now as on Alpari this level is 0. Please hint what needs to be corrected to avoid this error.


I think it's all about the GetPriceToInput() function.
 
sasha1995:


 double min=Low[iLowest(NULL,PERIOD_M15,MODE_LOW,32,0)];

how to write in 1.30320 format for EURUSD for example?

NormalizeDouble(...,Digits)
 
double max=High[iHighest(NULL,PERIOD_M15,MODE_HIGH,32,0)]; // find maximum of next 32 bars
double min=Low[iLowest(NULL,PERIOD_M15,MODE_LOW,32,0)]; // find minimum of next 32 bars
double min=NormalizeDouble(min,Digits); //convert to T/P

double max=NormalizeDouble(max,Digits); // convert to T/P

Ticket=OrderSend (Symbol(), OP_BUY, lot, Ask, 3,0, max, "Buy");

Please advise what is the error ? does not want to create take profit

I think I understand that ihighest gives only the index, but how do I find the highest price?

 
sasha1995:
double max=High[iHighest(NULL,PERIOD_M15,MODE_HIGH,32,0)]; // find maximum of next 32 bars
double min=Low[iLowest(NULL,PERIOD_M15,MODE_LOW,32,0)]; // find minimum of next 32 bars
double min=NormalizeDouble(min,Digits); //convert to T/P

double max=NormalizeDouble(max,Digits); // convert to T/P

Ticket=OrderSend (Symbol(), OP_BUY, lot, Ask, 3,0, max, "Buy");

Please advise what is the error ? does not want to create take profit

I think I have understood that ihighest gives only the index, but how to find the highest price?


High[i]

If priceHigh of zero bar is the highest of 32 last ones (price goes up), take profit value may be <= current price.

 
rigonich:

High[i].

I don't understand ) please explain
 
sasha1995:
double max=High[iHighest(NULL,PERIOD_M15,MODE_HIGH,32,0)]; // find maximum of next 32 bars
double min=Low[iLowest(NULL,PERIOD_M15,MODE_LOW,32,0)]; // find minimum of next 32 bars
double min=NormalizeDouble(min,Digits); //convert to T/P

double max=NormalizeDouble(max,Digits); // convert to T/P

Ticket=OrderSend (Symbol(), OP_BUY, lot, Ask, 3,0, max, "Buy");

Please advise what is the error ? does not want to create take profit

I think I understood that ihighest gives only index, but how to find the highest price?

This is a complete mess. Right:

 double max= NormalizeDouble (High[iHighest(NULL,PERIOD_M15,MODE_HIGH,32,0)], Digits); // найти максимум последующих 32 баров
 double min= NormalizeDouble (Low[iLowest(NULL,PERIOD_M15,MODE_LOW,32,0)], Digits); // найти минимум последующих 32 баров
 
sasha1995:

I don't understand ) Please explain

Prices high for the current chart are stored in an array -- timeseries High[]
 
TarasBY:

It's a complete mess. Right:


It doesn't work ( still no T/P output

if(TimeToStr(TimeCurrent(),TIME_SECONDS) == "00:00:00"){ // если время сервера 00:00:00, тогда

 double max= NormalizeDouble (High[iHighest(NULL,PERIOD_M15,MODE_HIGH,32,0)], Digits);

double min= NormalizeDouble (Low[iLowest(NULL,PERIOD_M15,MODE_LOW,32,0)], Digits); // ????? ??????? ??????????? 32 ?????

 }

 int Ticket;

if (TimeToStr(TimeCurrent(),TIME_SECONDS)== "09:00:00"){ // если время сервера 09:00:00, тогда

   if (napravl > 0){ // если направление больше 0, то

      Ticket=OrderSend (Symbol(), OP_BUY, lot, Ask, 3,0,max, "Покупаю"); // купить и поставить Take profit через 35 пунктов Bid + 385 * Point

      Alert (GetLastError());

   }

   else {

      if (napravl < 0) { // иначе, если направление меньше 0, то

        Ticket=OrderSend (Symbol(), OP_SELL, lot, Bid, 3,0,min, "Продаю"); // продать и поставить Take profit через 35 пунктов Ask - 385 * Point

         Alert (GetLastError());

      }

   }

//----

   return(0);

  } 

 

Good afternoon all, I am interested in such a question, how can I work with ticks, starting from some event, for example, compare the value of the first tick after some event and the n-th, as I understand during the function start the price, for example, Bid all the time is overwritten, plus I can operate with the previous value, but how to operate with the pre-prime and so on, where and how it all written? Thank you for your attention)