I am trying to construct two arrays, one for price and one for time. It appears to be difficult to find a correct correlation between the time at the end of the bar and the close.
(and this for e.g. the previous 20 or 30 bars of a specific time-frame chart).
At first I would have thought this is not a difficult problem, maybe there is some misunderstanding from my side ???
Any suggestions are welcome
My abreviated script is below:
function preMain()
{
setPriceStudy(false);
setStudyTitle("Time Price study");
setCursorLabelName("Time_Price");
}
function main(nLength,nBarPlus)
{
var mPrices = new Array(depth);
var mTimes = new Array(depth);
var depth = 30;
var parameter;
var period = getInterval();
var vPrice = getValue("Close", 0, -depth);
var vTime = getValue("rawtime",-depth)
for(i = 0; i < depth; i++)
{
mPrices[i] = vPrice[i];
// this is a first possibility for a one minute chart,
// does not work out
mTimes[i] = - 60 * i ;
// this is a second possibility for a one minute chart,
// does not work out either
mTimes[i]=vTime[i];
}
//meaningless example
parameter=(vPrice[0]-vPrice[1])/(
return(parameter);
}
It is obvious that I want to make this thing robuts enough to spand over the non-trading periods (week-ends and nights).
(and this for e.g. the previous 20 or 30 bars of a specific time-frame chart).
At first I would have thought this is not a difficult problem, maybe there is some misunderstanding from my side ???
Any suggestions are welcome
My abreviated script is below:
function preMain()
{
setPriceStudy(false);
setStudyTitle("Time Price study");
setCursorLabelName("Time_Price");
}
function main(nLength,nBarPlus)
{
var mPrices = new Array(depth);
var mTimes = new Array(depth);
var depth = 30;
var parameter;
var period = getInterval();
var vPrice = getValue("Close", 0, -depth);
var vTime = getValue("rawtime",-depth)
for(i = 0; i < depth; i++)
{
mPrices[i] = vPrice[i];
// this is a first possibility for a one minute chart,
// does not work out
mTimes[i] = - 60 * i ;
// this is a second possibility for a one minute chart,
// does not work out either
mTimes[i]=vTime[i];
}
//meaningless example
parameter=(vPrice[0]-vPrice[1])/(
return(parameter);
}
It is obvious that I want to make this thing robuts enough to spand over the non-trading periods (week-ends and nights).
Comment