| / | Forum |
|
tonyfox
2008.02.24 08:34
I need a way to get the close and open from specific bars each day. the close from the M5 bar with time of 9:55 the open from the M5 bar with time of 00:00 I know this has something to do with ibarshift but I'm not sure how to write the code out. Thanks Tony |
|
30 days have passed since Registration started. Almost 650 people have already applied for participation. This is practically equal to the total amount of applications in Championship 2006. There are still 52 days left until Registration is over. |
|
PipRaider
2008.02.24 09:28
datetime time=D'2008.02.22 00:00'; Comment("\nOpening Price : ", opening_price, |
|
bearking
2008.03.27 19:04
PipRaider wrote: datetime time=D'2008.02.22 00:00'; Comment("\nOpening Price : ", opening_price, This can only shows the price at 2008.02.22, what if we need it for everyday at this time? thank you very much. |
|
phy
2008.03.27 19:15
double value1[]; double value2[]; ArrayResize(value1, Bars); ArrayResize(value2, Bars); for(int i = Bars-1; i >= 0; i--){ if(TimeHour(Time[i]) == 9 && TimeMinute(Time[i]) == 55) value1[i] = Close[i]); if(TimeHour(Time[i]) == 0 && TimeMinute(Time[i]) == 0) value2[i] = Open[i]); } |
|
bearking
2008.03.27 19:30
phy wrote: double value1[]; double value2[]; ArrayResize(value1, Bars); ArrayResize(value2, Bars); for(int i = Bars-1; i >= 0; i--){ if(TimeHour(Time[i]) == 9 && TimeMinute(Time[i]) == 55) value1[i] = Close[i]); if(TimeHour(Time[i]) == 0 && TimeMinute(Time[i]) == 0) value2[i] = Open[i]); } Phy, Thank you very much for your code. The problem now is when i try to run the backtest on the tick basis, it will show a lot of results, can we take in only the first result right after 9:54:59?? |
|
phy
2008.03.27 20:56
double value1[]; double value2[]; ArrayResize(value1, Bars); ArrayResize(value2, Bars); for(int i = Bars-1; i >= 0; i--){ if(TimeHour(Time[i]) == 10 && TimeMinute(Time[i]) == 00) value1[i+1] = Close[i+1]); if(TimeHour(Time[i]) == 0 && TimeMinute(Time[i]) == 5) value2[i+1] = Open[i+1]); } |
|
bearking
2008.03.28 08:16
phy wrote: double value1[]; double value2[]; ArrayResize(value1, Bars); ArrayResize(value2, Bars); for(int i = Bars-1; i >= 0; i--){ if(TimeHour(Time[i]) == 10 && TimeMinute(Time[i]) == 00) value1[i+1] = Close[i+1]); if(TimeHour(Time[i]) == 0 && TimeMinute(Time[i]) == 5) value2[i+1] = Open[i+1]); } Dear Phy, Actually what i want to do is very simple it is just to get the open price for a bar at time 21:00:00 of each day, can I know is there any specific function to get this value? I tried it with an IF loop, but when i run the back test on the tick mode, i will miss out some days, because there's no tick happening at 21:00:00 for those days, so the program is not activated. And for the code above, i added another line Print("The closing price is :",value1);, but it doesn't print out any value, why?? Please help..... Thank you..... |