RIPORTO IL LINGUAGGIO DA ME SCRITTO...(ho modificato uno gia esistente ) :
/************************
Copyright © Gil_Cagne, 2004
*************************/
/*
Description: Contiene i ritracciamenti intrday 0.382 e 0.618 del movimento del gg prima
*/
function preMain() {
setPriceStudy(true);
setStudyTitle("Gil_retracement_intrday");
setCursorLabelName("0.382", 1);
setCursorLabelName("0.618", 2);
// R2
setDefaultBarStyle(PS_DASH, 1);
setDefaultBarFgColor(Color.RGB(255,0,0), 1);
setDefaultBarThickness(2, 1);
// R1
setDefaultBarStyle(PS_DASH, 2);
setDefaultBarFgColor(Color.RGB(0,0,255), 2);
setDefaultBarThickness(1, 2);
}
// Start of Performance addition
var vLastRawTime = null;
var vLastPPR1 = null;
var vLastPPR2 = null;
var vLastArray = null;
var vSymbol = null;
var vInterval = null;
var vReset = true;
function main() {
var vH;
var vL;
var vC;
var vRawTime;
var vBarTime;
var vIndex;
var nState = getBarState();
if(vReset == true) {
vLastRawTime = null;
vLastArray = null;
vLastPPR1 = null;
vLastPPR2 = null;
vInterval = getInterval();
vSymbol = getSymbol();
vSymbol += ",D";
vReset = false;
}
vRawTime = getDay();
if(vRawTime == null)
return;
// Start of Performance addition
if(vRawTime != null && vLastRawTime != null) {
if(vRawTime == vLastRawTime) {
return vLastArray;
}
}
if(vInterval == null)
return null;
if(vInterval == "D")
return null;
if(vInterval == "W")
return null;
if(vInterval == "M")
return null;
if(vInterval == "T")
return null;
vBarTime = getValue("time");
if(vBarTime != null) {
var vDay = vBarTime.getDay();
if (vDay == 0) {
var vDate = vBarTime.getDate();
vDate -= 2;
vBarTime.setDate(vDate);
}
vAbsTime = getPreviousTradingDay(vBarTime, vSymbol);
if(vAbsTime == null) {
return;
}
vIndex = getFirstBarIndexOfDay(vAbsTime, vSymbol);
if(vIndex != null) {
vH = getValueAbsolute("High", vIndex, vSymbol);
vL = getValueAbsolute("Low", vIndex, vSymbol);
if(vH != null && vL != null ) {
vLastPPR1 =((vH - vL)*0.382) + vL;
vLastPPR2 = ((vH - vL)*0.618) + vL;
vLastRawTime = vRawTime;
vLastArray = new Array(vLastPPR1, vLastPPR2);
return vLastArray;
}
}
}
return null;
}
/************************
Copyright © Gil_Cagne, 2004
*************************/
/*
Description: Contiene i ritracciamenti intrday 0.382 e 0.618 del movimento del gg prima
*/
function preMain() {
setPriceStudy(true);
setStudyTitle("Gil_retracement_intrday");
setCursorLabelName("0.382", 1);
setCursorLabelName("0.618", 2);
// R2
setDefaultBarStyle(PS_DASH, 1);
setDefaultBarFgColor(Color.RGB(255,0,0), 1);
setDefaultBarThickness(2, 1);
// R1
setDefaultBarStyle(PS_DASH, 2);
setDefaultBarFgColor(Color.RGB(0,0,255), 2);
setDefaultBarThickness(1, 2);
}
// Start of Performance addition
var vLastRawTime = null;
var vLastPPR1 = null;
var vLastPPR2 = null;
var vLastArray = null;
var vSymbol = null;
var vInterval = null;
var vReset = true;
function main() {
var vH;
var vL;
var vC;
var vRawTime;
var vBarTime;
var vIndex;
var nState = getBarState();
if(vReset == true) {
vLastRawTime = null;
vLastArray = null;
vLastPPR1 = null;
vLastPPR2 = null;
vInterval = getInterval();
vSymbol = getSymbol();
vSymbol += ",D";
vReset = false;
}
vRawTime = getDay();
if(vRawTime == null)
return;
// Start of Performance addition
if(vRawTime != null && vLastRawTime != null) {
if(vRawTime == vLastRawTime) {
return vLastArray;
}
}
if(vInterval == null)
return null;
if(vInterval == "D")
return null;
if(vInterval == "W")
return null;
if(vInterval == "M")
return null;
if(vInterval == "T")
return null;
vBarTime = getValue("time");
if(vBarTime != null) {
var vDay = vBarTime.getDay();
if (vDay == 0) {
var vDate = vBarTime.getDate();
vDate -= 2;
vBarTime.setDate(vDate);
}
vAbsTime = getPreviousTradingDay(vBarTime, vSymbol);
if(vAbsTime == null) {
return;
}
vIndex = getFirstBarIndexOfDay(vAbsTime, vSymbol);
if(vIndex != null) {
vH = getValueAbsolute("High", vIndex, vSymbol);
vL = getValueAbsolute("Low", vIndex, vSymbol);
if(vH != null && vL != null ) {
vLastPPR1 =((vH - vL)*0.382) + vL;
vLastPPR2 = ((vH - vL)*0.618) + vL;
vLastRawTime = vRawTime;
vLastArray = new Array(vLastPPR1, vLastPPR2);
return vLastArray;
}
}
}
return null;
}
Comment