[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 576

 

Need to normalise the price chart, any currency pair of your choice. I need it for an indicator. I tried to divide the current value by the previous one - I get some kind of oscillator around 1. I have come up with an idea that I should convert the chart from absolute to relative values, i.e. in this case I will be able to see the percentage change of quote. It has been implemented. It is already better and practically what we need. However, my ultimate desire is to normalize quotes in the range [0:1] .By the way, here is what I need but in bourgeois - I would like the same in russian: http://people.revoledu.com/kardi/tutorial/Similarity/Normalization.html

I already got tired of fighting with this. I can't delete all pending orders normally, I just don't get the hang of it:

   for (int i=OrdersTotal()-1;i>=0;i--)
      if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
         if (OrderType()==OP_BUYLIMIT || OrderType()==OP_SELLLIMIT)
            if (OrderMagicNumber()==Magik && OrderSymbol()==Symbol())
            while(!OrderDelete(OrderTicket(),CLR_NONE)){}

I even added to the loop FOR WHILE the deleted orders are still there, but I still have not deleted them. I have many pending orders to delete, i.e. about 20, may be it is something complicated?

 
Sergstuddek:
Kindly advise how to work with arrays, I need to select the maximum and minimum values of closing and opening the bar, in the time interval from 1.00 to 10.00, I tried to do so, but it's not right. It gives out '[' - array index is to be an integer C:\Program Files\InstaTrader\experts\Probase19 EUR-JPY.mq4 (61, 21)
What is wrong, how to fix

The warning means -- the array index must be a number of int type. You need to use iClose() and iOpen(). Determine the number of the bar, which open time is 1h and select in the cycle from the next 10 bars, the ones you want.


 
Ekburg:

That's the thing: everything is normal there! I put printers for this purpose, so that during the test I could trace what values are sent to the modification function, everything is normal there, the stop is different, nothing extra is thrown, everything is within the limits allowed by the server, and the opponents in the code above do not allow to send the same values.

I don't know. At me after has put check directly before OrderModify() after OrderSelect(), error 1 has ceased to give out, and earlier too has constantly flashed.
 
rigonich:

The warning means -- the array index must be a number of int type. You need to use iClose() and iOpen() functions. Determine the number of the bar whose opening time is 1 h and select in the loop from the next 10 bars the ones you want.
Thanks for the reply. Theoretically I understand what you want to say, but to be honest I can't figure out how to do it in practice, maybe you have some example.
 
Desead:

Need to normalise the price chart, any currency pair of your choice. I need it for an indicator. I tried to divide the current value by the previous one - I get some kind of oscillator around 1. I have come up with an idea that I should convert the chart from absolute to relative values, i.e. in this case I will be able to see the percentage change of quote. It has been implemented. It is already better and practically what we need. However, my ultimate desire is to normalize quotes in the range [0:1] .By the way, here is what I need but in bourgeois - I would like the same in russian: http://people.revoledu.com/kardi/tutorial/Similarity/Normalization.html

I already got tired of fighting with this. I can't delete all pending orders normally, I just don't get the hang of it:

I even added to the loop FOR WHILE the deleted orders are still there, but I still have not deleted them. I have many pending orders to delete, i.e. about 20, may be it is something complicated?


to your first question - look at the stochastic
 
Desead:

Need to normalise the price chart, any currency pair of your choice. I need it for an indicator. I tried to divide the current value by the previous one - I get some kind of oscillator around 1. I have come up with an idea that I should convert the chart from absolute to relative values, i.e. in this case I will be able to see the percentage change of quote. It has been implemented. It is already better and practically what we need. However, my ultimate desire is to normalize quotes in the range [0:1] .By the way, here is what I need but in bourgeois - I would like the same in russian: http://people.revoledu.com/kardi/tutorial/Similarity/Normalization.html

I already got tired of fighting with this. I can't delete all pending orders normally, I just don't get the hang of it:

I even added to the loop FOR WHILE the deleted orders are still there, but I still have not deleted them. I have many pending orders to delete, i.e. about 20, may be it is something complicated?


I already tried to put and delete all pending orders the same way as I already have, but I don't want to do it any other way. If anyone knows, can you tell me why?
 
Sergstuddek:
People kindly advise how to work with arrays, I need to select the maximum and minimum values of the closing and opening the bar, in the time interval from 1.00 to 10.00, I tried to do so, but something is wrong. It gives out '[' - array index is to be an integer C:\Program Files\InstaTrader\experts\Profiler19 EUR-JPY.mq4 (61, 21)
What's wrong, how to fix it

I have redesigned it as follows

int MAX()
{
if (Hour()==10)
        {
      
        for(i=0; i<=9; i++)
        double MAX1 = High [iHighest(Symbol(), PERIOD_H1,MODE_CLOSE,i,0)];
        }
        return(MAX1);
        
}

I do not get errors, but the price does not work, or rather it does not work correctly, what is the problem?

 
Sergstuddek:

I have redesigned it as follows

It no longer gives out errors, but it does not detect the price, or rather it does, but not correctly, what is the problem?

It will search for the bar index with the maximum price in the last 9 bars, provided that you run the program at 10 o'clock. Hour() is the start time of the program (server time).

P.S. More precisely, not the index, but the maximum price (High) of that bar.

Files:
 

Please help, as soon as I put other sl and tp does not work buying, opens the lot only with the sale.

#define MAGIC 1234
#define IDENT "mo_bidir"

extern int lots = 1;
extern int stop_loss = 76; //
extern int take_profit = 750; //
extern int steps = 5;// Шаг отложенных ордеров

int start(){

if (OrdersTotal() == 0){
OrderSend(Symbol(), OP_BUY, lots ,Ask, 3, Ask - stop_loss * Point, Bid + take_profit * Point, IDENT, MAGIC, 0, Blue);
OrderSend(Symbol(), OP_SELL, lots ,Bid, 3, Bid + take_profit * Point, Ask - take_profit * Point, IDENT, MAGIC, 0, Red);
OrderSend(Symbol(), OP_BUYSTOP, 0.05*lots,Ask+steps*Point, 3, Ask + stop_loss * Point, Bid + take_profit * Point, IDENT, MAGIC, 0, Blue);
OrderSend(Symbol(), OP_SELLSTOP, 0.05*lots,Bid-steps*Point, 3, Bid - take_profit * Point, Ask - take_profit * Point, IDENT, MAGIC, 0, Red);
}
return(0);
} 
 
samaelfess:

Please help, as soon as I put the other sl and tp does not work buying, opens the lot only with the sale.



You have Bid + stop_loss instead of Bid + take_profit. And in pending for OP_BUYSTOP Ask + stop_loss, instead ofAsk - stop_loss and for OP_SELLSTOP -- Bid - take_profit instead of Bid + take_profit.

And all the prices are not normalised.

P.S. I wonder if it works with not other sl and tp?