English

## Keeping track of multiple _potential_ orders?

 13130 WHRoeder 2016.04.07 15:29 #   ikonii:1) In the picture below there is two confirmations of possible trade entries coming. How would you keep track of them separately (with the time they were detected and the price they were detected at). There might be up to 3-5 of these indicators in a short timespan. Just omitting all old signals and tracking the last one is the simplest solutions, but I want to explore the possibility of keeping track of multiple just for practice sake.2) I want to optimize the time allowed between an indicator and the trade entry. Pictured below is just 1 5min candle in between, but usually this could be anything between 1 to let's say 20 candles. How can I track this?3) Right now the robot is simply looking back 50 candles and comparing the closing prices of bearish candles. Any idea how could I set a minimum and a maximum of the allowed distance between two potential bearish candles?Remember the time and price detected.iBarShift will tell you how many candles back. If it's too far back, forget it.No need to look back. If the last closed candle didn't exceed the price, neither did any others. If it did, remove signal from the array, and open.Something like```struct coord{ datetime when; double price}; coord levels[]; void remove_level(int i){     int n = arraySize(levels);     levels[i] = levels[--n]; ArrayResize(levels, n); } void add_level(datetime when, double price){    int n = ArraySize(levels);    ArrayResize(levels, n + 1, 16);    level[n].when = when;   level[n].price = price; } void OnTick(){    static datetime time0=0; datetime p0=time0; time0=Time[0]; bool isNewBar=(p0!=time0);    if(isNewBar){       for(int i=ArraySize(levels)-1; i>=0; --i){          // check old levels          int iBar = iBarShift(NULL,0, levels[i].when);          if(iBar > maxHold) remove_level(i);          // check last bar          else if(Close[1] > levels[i].price){ process_level(i); remove_level(i); }       }       // check for new signals       if(signal(1)) add_level(Time[1], High[1]);   } // isNewBar   : }```