Hello,
there is KST of Pring in esignal efs ? and if not it's possible to built it ?
Thanks Ciro
there is KST of Pring in esignal efs ? and if not it's possible to built it ?
Thanks Ciro
var roc6 = new ROCStudy(6, "Close"); var roc10 = new ROCStudy(10, "Close"); var roc15 = new ROCStudy(15, "Close"); var roc20 = new ROCStudy(20, "Close"); function preMain() { setStudyTitle("KST"); setCursorLabelName("KST", 0); setDefaultBarFgColor(Color.blue, 0); addBand(0, PS_SOLID, 1, Color.black); } function main() { var i; var vROC6 = roc6.getValue(ROCStudy.ROC,0,-10); var vROC10 = roc10.getValue(ROCStudy.ROC,0,-10); var vROC15 = roc15.getValue(ROCStudy.ROC,0,-8); var vROC20 = roc20.getValue(ROCStudy.ROC,0,-15); var Sum6 = 0, Sum10 = 0, Sum15 = 0, Sum20 = 0; if(vROC6 == null || vROC10 == null || vROC15 == null || vROC20 == null) return; for(i = - 14; i <= 0; i++){ if(i > -6) Sum6 += roc6.getValue(ROCStudy.ROC,i); if(i > -10) Sum10 += roc10.getValue(ROCStudy.ROC,i); if(i > -8) Sum15 += roc15.getValue(ROCStudy.ROC,i);; Sum20 += roc20.getValue(ROCStudy.ROC,i);; } return (Sum6 / 6 + (Sum10 / 10) * 2 + (Sum15 / 8) * 3 + (Sum20 / 15) * 4); }
var roc6 = new ROCStudy(6, "Close"); var roc10 = new ROCStudy(10, "Close"); var roc15 = new ROCStudy(15, "Close"); var roc20 = new ROCStudy(20, "Close"); function preMain() { setStudyTitle("KST"); setCursorLabelName("KST", 0); setDefaultBarFgColor(Color.blue, 0); setCursorLabelName("EMA", 1); setDefaultBarFgColor(Color.red, 1); addBand(0, PS_SOLID, 1, Color.black); } var EMA_1 = 0; function main(EMA_Len) { if (EMA_Len == null) EMA_Len = 14; var i = 0; var kst = 0; var vROC6 = roc6.getValue(ROCStudy.ROC,0,-10); var vROC10 = roc10.getValue(ROCStudy.ROC,0,-10); var vROC15 = roc15.getValue(ROCStudy.ROC,0,-8); var vROC20 = roc20.getValue(ROCStudy.ROC,0,-15); var Sum6 = 0, Sum10 = 0, Sum15 = 0, Sum20 = 0; if(vROC6 == null || vROC10 == null || vROC15 == null || vROC20 == null) return; for(i = - 14; i <= 0; i++){ if(i > -6) Sum6 += roc6.getValue(ROCStudy.ROC,i); if(i > -10) Sum10 += roc10.getValue(ROCStudy.ROC,i); if(i > -8) Sum15 += roc15.getValue(ROCStudy.ROC,i);; Sum20 += roc20.getValue(ROCStudy.ROC,i);; } kst = Sum6 / 6 + (Sum10 / 10) * 2 + (Sum15 / 8) * 3 + (Sum20 / 15) * 4; var K = 2 / (EMA_Len + 1); var EMA = K * kst + (1 - K) * EMA_1; if (getBarState() == BARSTATE_NEWBAR) EMA_1 = EMA; return new Array(kst,EMA); }
var roc6 = new ROCStudy(6, "Close"); var roc10 = new ROCStudy(10, "Close"); var roc15 = new ROCStudy(15, "Close"); var roc20 = new ROCStudy(20, "Close"); function preMain() { setStudyTitle("KST Strategy"); setCursorLabelName("KST", 0); setDefaultBarFgColor(Color.blue, 0); setCursorLabelName("EMA", 1); setDefaultBarFgColor(Color.red, 1); addBand(0, PS_SOLID, 1, Color.black); setDefaultPriceBarColor(Color.grey); setPriceStudy(true); } var EMA_1 = 0; function main(EMA_Len) { if (EMA_Len == null) EMA_Len = 14; var vHL = high() - low(); var vVar = vHL * 0.25; var vAddVar = vVar * 0.35; var i = 0; var i = 0; var kst = 0; var vROC6 = roc6.getValue(ROCStudy.ROC,0,-10); var vROC10 = roc10.getValue(ROCStudy.ROC,0,-10); var vROC15 = roc15.getValue(ROCStudy.ROC,0,-8); var vROC20 = roc20.getValue(ROCStudy.ROC,0,-15); var Sum6 = 0, Sum10 = 0, Sum15 = 0, Sum20 = 0; if(vROC6 == null || vROC10 == null || vROC15 == null || vROC20 == null) return; for(i = - 14; i <= 0; i++){ if(i > -6) Sum6 += roc6.getValue(ROCStudy.ROC,i); if(i > -10) Sum10 += roc10.getValue(ROCStudy.ROC,i); if(i > -8) Sum15 += roc15.getValue(ROCStudy.ROC,i);; Sum20 += roc20.getValue(ROCStudy.ROC,i);; } kst = Sum6 / 6 + (Sum10 / 10) * 2 + (Sum15 / 8) * 3 + (Sum20 / 15) * 4; var K = 2 / (EMA_Len + 1); var EMA = K * kst + (1 - K) * EMA_1; if(EMA < kst && !Strategy.isLong()){ Strategy.doLong("Long", Strategy.MARKET, Strategy.NEXTBAR); drawShapeRelative(0, low() - vVar, Shape.UPARROW, "", Color.lime, null, "buyShp" + getValue("time")); drawTextRelative(-1, low() - (vVar + vAddVar), "Buy", Color.black, Color.lime, Text.BOLD | Text.ONTOP, null, null, "buyTxt" + getValue("time")); } if(EMA > kst && !Strategy.isShort()){ Strategy.doShort("Short", Strategy.MARKET, Strategy.NEXTBAR); drawShapeRelative(0, high() + vVar, Shape.DOWNARROW, "", Color.red, null, "sellShp" + getValue("time")); drawTextRelative(-1, high() + (vVar + vAddVar), "Short", Color.black, Color.red, Text.BOTTOM | Text.BOLD | Text.ONTOP, null, null, "buyTxt" + getValue("time")); } if(Strategy.isLong()) setPriceBarColor(Color.lime); if(Strategy.isShort()) setPriceBarColor(Color.red); if (getBarState() == BARSTATE_NEWBAR) EMA_1 = EMA; return; }
Comment