Hi , sorry for this beginners post , i am trying to code my strategy and wish to store the values of a moving average across last 10 bars from the 6-15 bar back to the 4-00am bar.
My idea was test for 6-30(15min time frame) and store the values in an array BarMa[10], i coded this and tried to print results to se if it was reading values but no joy - if someone can help that would be really great
int start()
{
//----
int bar, limit=10; // bar count to go back 10 bars
int BarMa[10]; // set array to store ma values
int InPlayhr = 6, InPlaymin = 30; // start time for look back ie 6-15 - 4-00 candles
if(TimeHour(CurTime())==InPlayhr&&TimeMinute(CurTime())==InPlaymin)
// test is it for 6-30
{
for(bar=0; bar<limit; bar++) // loop to store values for ma
BarMa[bar] = iMA(NULL,PERIOD_M15,40,0,MODE_SMA,PRICE_CLOSE,bar);
Print ("InPlay");
for(bar=0; bar<limit; bar++)
Print (BarMa[bar]);
return(0);
}
//----
return(0);
}
My idea was test for 6-30(15min time frame) and store the values in an array BarMa[10], i coded this and tried to print results to se if it was reading values but no joy - if someone can help that would be really great
int start()
{
//----
int bar, limit=10; // bar count to go back 10 bars
int BarMa[10]; // set array to store ma values
int InPlayhr = 6, InPlaymin = 30; // start time for look back ie 6-15 - 4-00 candles
if(TimeHour(CurTime())==InPlayhr&&TimeMinute(CurTime())==InPlaymin)
// test is it for 6-30
{
for(bar=0; bar<limit; bar++) // loop to store values for ma
BarMa[bar] = iMA(NULL,PERIOD_M15,40,0,MODE_SMA,PRICE_CLOSE,bar);
Print ("InPlay");
for(bar=0; bar<limit; bar++)
Print (BarMa[bar]);
return(0);
}
//----
return(0);
}