Posted By: tradingest
Series within loop - 10/07/18 21:39
Hi guys,
I want to calculate the Open and Close price of the candle of the previous day. To do this I use the code below but my function run() is performed each 1 min (BarPeriod = 1) and I see the same value for each minute as shown here.
I have 2 question about the point above:
1. Is it possible to skip each minute and calculate the daily value at the previous candle only once?
2. Inserting the series within loop the message is Error041: Inconsistent series!. I see the manual but I don't understand how to avoid this problem.
Can you help me to resolve it?
Thanks in advance
I want to calculate the Open and Close price of the candle of the previous day. To do this I use the code below but my function run() is performed each 1 min (BarPeriod = 1) and I see the same value for each minute as shown here.
Code:
vars PriceC = series(priceClose()); vars PriceO = series(priceOpen());
I have 2 question about the point above:
1. Is it possible to skip each minute and calculate the daily value at the previous candle only once?
2. Inserting the series within loop the message is Error041: Inconsistent series!. I see the manual but I don't understand how to avoid this problem.
Code:
if(hour() == 00) { while(asset(loop(Assets))) { vars O = series(priceOpen()); vars C = series(priceClose()); } }
Can you help me to resolve it?
Thanks in advance