Announcement

Collapse
No announcement yet.

KST - for ts support ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • KST - for ts support ?

    Hello,
    there is KST of Pring in esignal efs ? and if not it's possible to built it ?
    Thanks Ciro

  • #2
    Dear Ciro,

    The KST indicator is a weighted summed rate of change oscillator that is designed to identify meaningful turns. Various smoothed rate of change indicators can be combined to form different measurements of cycles. For more interpretation refer to Martin Pring's article "Summed Rate of Change (KST)" in the September 92 issue of TASC.

    Usage:

    - One method of using the KST is to apply trendline analysis to the indicator.

    - The KST can also be interpreted with the same principles that would be applied to other oscillators.

    Code:

    Code:
    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);
    }
    If you have any further questions or require additional assistance please let me know.

    Regards,
    Andy

    Comment


    • #3
      Thanks a lot

      Dear andy,
      i have receipt your answer and efs code, thank a lot!!!
      I want to add at kst a moving average as trigger, how is possible to make it ?

      Comment


      • #4
        Code:
        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);
        }

        Comment


        • #5
          Trading sistem

          Dear Andy,
          i want to built my personal TS, but i don't understand how to built it. As set stop, trailing stop and etc....

          Do you can help me ?? in my first time ??

          the idea is simple....
          i want to buy (do.long) when ema14>kst or short when ema14<kst...

          two exit condition
          1) Low(-4) >= low(-2)&&
          low(-3) >= low(-2)&&
          low(-1) >= low(-2)&&
          low() >= low (-2)
          if is true then low(-2) is my trailing stop (new stop)

          else exit when (long) ema14<kst or (short) or ema14>kst

          Can you help me ??
          thank ciro

          Comment


          • #6
            Code:
            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


            • #7
              thank a lot

              Dear Andy,
              thank a lot for help me. I think that esignal user satisfaction is 100%!!!. Tomorrow i start with creation of my first esignal TS. When i have problem i send you an help mail!!!
              Regards, Ciro

              Comment


              • #8
                set stop, trailing stop

                I have create a simple TS with moving average as beta test. my problem is after stragy.dolong is

                set stop loss and if trade is good change stop loss into trailing stop.

                i attach my efs, can you help me in set stop loss and trailing.
                regards Ciro
                Attached Files

                Comment

                Working...
                X