Hallo all; someone should help me to translate in powerlanguage this formula from metastock?
(Mov(Stoch(40,20),5,S)-50)
i cannot understand how to do because in MC the stocastic formula does not have unique result but 4 results oFastK oFastD etc...
do you have any idea?
Translate stocastic formula
-
- Posts: 742
- Joined: 09 Apr 2010
- Location: Texas
- Has thanked: 483 times
- Been thanked: 274 times
- Contact:
Re: Translate stocastic formula
This is my translation into MC for a Metastock stochastic, not sure if it matches yours exactly but it's a Metastock translation into MC that I had on hand.
Metak Function:
Code: Select all
[LegacyColorValue = TRUE];
Input: KPeriods(14),DPeriods(3),KSlow(3),Sellzone(80),Buyzone(20);
Plot1(METAK(KPeriods,Kslow),"%K");
Plot2(Average(METAK(KPeriods,Kslow),DPeriods),"xvr");
Plot3(Sellzone,"Plot3");
Plot4(Buyzone,"Plot4");
Code: Select all
[LegacyColorValue = TRUE];
Inputs: KPeriods(NumericSimple), KSlow(NumericSimple);
Value1=Lowest(Low,KPeriods);
Value2=Highest(High,KPeriods);
Value3=Value2-Value1;
If Value3>0 then begin
If KSlow<=1 then METAK=(Close - Value1)/(Value3)*100
else
METAK=Average(Close - Value1,KSlow)/Average(Value3,KSlow)*100;
End;
if Average(Close - Value1,KSlow)<0 then Metak=0;