Hi,
I need some help with the reload of a study.
This study, is loaded by reading a set of forecasted prices that are computed by one of our servers.
The prices are saved on an external txt file, and access through the http object. This is working great. I've added the access to the http in a fuction, called loaddata() and saved that on a library.
This forecasted price, is protected with a user and pass that are loaded as external variables to the efs.
The code is as follows.
function main(frUser, frPassword, frColor){
if (getBarState() == BARSTATE_ALLBARS) {
sSymbol = getSymbol(); //grab the name of the symbol being charted for later use
nInterval = getInterval(); //grab the bar interval we are using for later use
frUserPub = frUser;
frPasswordPub = frPassword;
var nData = PLLibrary.loadData(); //call loadData to load the Prediction data that corresponds to the Charted Series
return;
}
if (nBarState == BARSTATE_NEWBAR) {
var nResult = PLLibrary.Position(); //call Position to know where to start plotting.
var Offset = MyCount;
var PastBar = 0;
for (var x=2; x<=Offset; x++){
drawLineRelative(x-1-Correction,aPrediction[x-1],x-Correction,aPrediction[x] ,PS_SOLID,3,Color.grey,"plot"+x);
}
}
The problem I have is that the study loads perfect on the first load, but does not update on new bar, as I think it shoudl using the nBarState == BARSTATE_NEWBAR.
The Study looks like this.
Any help is very weolcomed.
Thanks,
Dan
I need some help with the reload of a study.
This study, is loaded by reading a set of forecasted prices that are computed by one of our servers.
The prices are saved on an external txt file, and access through the http object. This is working great. I've added the access to the http in a fuction, called loaddata() and saved that on a library.
This forecasted price, is protected with a user and pass that are loaded as external variables to the efs.
The code is as follows.
function main(frUser, frPassword, frColor){
if (getBarState() == BARSTATE_ALLBARS) {
sSymbol = getSymbol(); //grab the name of the symbol being charted for later use
nInterval = getInterval(); //grab the bar interval we are using for later use
frUserPub = frUser;
frPasswordPub = frPassword;
var nData = PLLibrary.loadData(); //call loadData to load the Prediction data that corresponds to the Charted Series
return;
}
if (nBarState == BARSTATE_NEWBAR) {
var nResult = PLLibrary.Position(); //call Position to know where to start plotting.
var Offset = MyCount;
var PastBar = 0;
for (var x=2; x<=Offset; x++){
drawLineRelative(x-1-Correction,aPrediction[x-1],x-Correction,aPrediction[x] ,PS_SOLID,3,Color.grey,"plot"+x);
}
}
The problem I have is that the study loads perfect on the first load, but does not update on new bar, as I think it shoudl using the nBarState == BARSTATE_NEWBAR.
The Study looks like this.
Any help is very weolcomed.
Thanks,
Dan
Comment