Yený cýkan ýndýkatorlerý burada yayýnlayacagým , metastock ýcýn
Meraklýlarýna, beným ýndýkatorle ýsým olmaz, ama denemek ýsteyenler ýcýn
Yený cýkan ýndýkatorlerý burada yayýnlayacagým , metastock ýcýn
Meraklýlarýna, beným ýndýkatorle ýsým olmaz, ama denemek ýsteyenler ýcýn
Stocks & commodities yený sayýsý yený cýkan 3 adet metastock ýndýkatorler
meraklýlarýna
--------------------------------
{Volume weighted moving average of closes}
Periods:=Input("Enter number of periods",1,500,52);
(Sum(V*C,Periods)/Sum(V,Periods))
-------------------------------------------
the formula for the VWEMA would be:
{Volume weighted exponential moving average of closes}
Periods:=Input("Enter number of periods",1,500,22);
(Mov(V*C,Periods,E))/(Mov(V,Periods,E))
--------------------------------------------------
The volume-weighted MACD histogram
PeriodS:=Input("Enter short period",1,500,12);
PeriodL:=Input("Enter long period",2,501,26);
PeriodSig:=Input("Enter smoothing period",1,200,9);
LongMA:=(PeriodL*Mov(V*C,PeriodL,E))/(PeriodL*Mov(V,PeriodL,E));
ShortMA:=(PeriodS*Mov(V*C,PeriodS,E))/(PeriodS*Mov(V,PeriodS,E));
VMACD:=(ShortMA-LongMA);
SignalLine:=Mov(VMACD,PeriodSig,E);
VMACD-SignalLine
Programming MIDAS and I-MIDAS in MetaStock
Code 1:
This code is for MIDAS to plot on the daily charts in MetaStock in the way originally
conceived by Paul Levine. Users will be requested to input a year, month, and day
corresponding to an appropriate swing high or low.
{User defined input}
sm:=Input("starting month",1,12,1);
sd:=Input("starting day of month",1,31,1);
sy:=Input("starting year",1980,2100,2000);
start:= sd=DayOfMonth() AND sm=Month() AND sy=Year();
{mid price}
pv:=MP()*V;
{Midas calculation}
denom:= If(Cum(V)-
ValueWhen(1,start,Cum(V))=0,1,Cum(V)-ValueWhen(1,start,Cum(V)));
If(BarsSince(start),(Cum(pv)-ValueWhen(1,start,Cum(pv)))/ denom,MP())
Code 2:
This code is for I-MIDAS to plot on any intraday chart in MetaStock Pro. Users will
also be requested to input the hour and minute. Speed can be an issue when a number of
M curves are plotted in MetaStock and MetaStock Pro. This is an area currently being
worked on by the author.
{User defined input}
sm:=Input("starting month",1,12,1);
sd:=Input("starting day of month",1,31,1);
sy:=Input("starting year",1980,2100,2000);
sh:=Input("hour", 1,24,1);
se:=Input("minute",0,60,0);
start:= sd=DayOfMonth() AND sm=Month() AND sy=Year() AND sh=Hour() AND se=Minute();
{mid price}
pv:=MP()*V;
{Midas calculation}
denom:= If(Cum(V)-
ValueWhen(1,start,Cum(V))=0,1,Cum(V)-ValueWhen(1,start,Cum(V)));
If(BarsSince(start),(Cum(pv)-ValueWhen(1,start,Cum(pv)))/ denom,MP())
FIXED-PERCENTAGE STOP METASTOCK CODE
{SVE_Stop_Trail%_Date: Fixed percentage trailing stop from date}
InpMonth:=Input("Month",1,12,1);
InpDay:=Input("Day",1,31,1);
InpYear:=Input("Year",1800,2050,2009);
LongShort:=Input("1=Long or 2=Short? ",1,2,1);
InitStop:=Input("Initial Stop Price",0.1,10000,10);
Perc:=Input("Trailing Stop Percentage",1,30,12);
Loss:=C*Perc/100;
Entry:= InpYear=Year() AND InpMonth=Month() AND InpDay=DayOfMonth();
StopLong:=ExtFml("AdvancedStop.StopLong", Entry,InitStop,0,C-Loss,0,0,0,0);
StopShort:=ExtFml("AdvancedStop.StopShort",Entry,I nitstop,0,C+Loss,0,0,0,0);
Trail:=If(LongShort=1,Stoplong,Stopshort);
Trail
The Pivot Detector Oscillator, Simplified" by Giorgos Siligardos
Name: PIDosc
-------------------------
{by Giorgos E. Siligardos}
sma200:=Mov(C,200,S);
bull:=C>sma200;
If(bull,(RSI(14)-35)/(85-35), (RSI(14)-20)/(70-20))*100;
To create an Expert Advisor for showing the PID signals, do the following:
Open the Expert Advisor and create a new expert:
Name: PID signals
Notes: by Giorgos E. Siligardos
Create two symbols:
First symbol:
Name: PID buy signal
Condition:
PIDosc:=Fml("PIDosc");
Cross(PIDosc,0)
Graphic: Buy Arrow
Color: Blue
Symbol Position: Below Price Plot
Second symbol:
Name: PID sell signal
Condition:
PIDosc:=Fml("PIDosc");
Cross(100,PIDosc)
Graphic: Sell Arrow
Color: Red
Symbol Position: Above Price Plot
HEIKIN-ASHI: METASTOCK FORMULA
colA:
haC := (O+H+L+C)/4;
haO := (PREV+Ref(haC,-1))/2;
haO
colB:
haC := (O+H+L+C)/4;
haO := (PREV+Ref(haC,-1))/2;
haH := Max(haC,Max(H,haO));
haH
colC:
haC := (O+H+L+C)/4;
haO := (PREV+Ref(haC,-1))/2;
haH := Max(haC,Max(H,haO));
haL := Min(haC,Min(L,haO));
haL
colD:
haC := (O+H+L+C)/4;
haO := (PREV+Ref(haC,-1))/2;
haH := Max(haC,Max(H,haO));
haL := Min(haC,Min(L,haO));
haC := (haC+haO+haH+haL)/4;
haC
The explorer I made is as follows:
column a
haopen:=(Ref((O+H+L+C)/4,-1)+PREV)/2;
haopen
column b
haopen:=(Ref((O+H+L+C)/4,-1)+PREV)/2;
hh:=Max(H,haopen);
hh
column c
haopen:=(Ref((O+H+L+C)/4,-1)+PREV)/2;
ll:=Min(L,haopen);
ll
column d
LLV(L,2)
column e
HHV(H,2)
column f
haopen:=(Ref((O+H+L+C)/4,-1)+PREV)/2;
hac:=((O+H+L+C)/4+haopen+Max(H,haopen)+Min(L,haopen))/4;
hac
Trailing Resistance and Support Stops" by Sylvain Vervoort.
Support trailing stop
I define a pivot support point in an up move when there is a low price that is equal or
lower than the two prices preceding and following this low price. You can use the
following MetaStock expression for this:
support:=If(L>=Ref(L,-2) AND Ref(L,-1)>=Ref(L,-2) AND Ref(L,-3)>=Ref(L,-2) AND
Ref(L,-4)>= Ref(L,-2),Ref(L,-2),{else}
We know that gaps or windows in an uptrend provide support. The low side of the window
is the lowest support level. In the next step, I will add code to detect gaps and make
use of the gap window support. My tests showed that requiring a minimum window size or
setting the stop lower than the previous high only slightly influences the final profit,
but it seems to bring down the number of trades by about 3%. Therefore, I set a minimum
gap requirement of 0.13% and placed the stop 0.55% below the previous high.
If(L>Ref(H,-1)*1.0013,Ref(H,-1)*0.9945,{else}
Price can move up for a number of days without creating a pivot or gap window support.
In such circumstances, to avoid the trailing stop moving too far away from the price
action, I enforced a maximum allowable loss. For example, if I allowed a maximum loss
of 10%, the previous stop level will move up by half that amount, or 5% higher.
If(L>PREV*1.1,PREV*1.05,{else}
To create the Tr&nds trailing stop for an uptrend, I will use the same setup as I did
with the other trailing-stop methods. I am referencing a "_resistance" formula here to
be able to switch from an up to a down move. We will see later how this _resistance
formula is created.
resistance:=Fml("_resistance");
support:=If(L>=Ref(L,-2) AND Ref(L,-1)>=Ref(L,-2) AND Ref(L,-3)>=Ref(L,-2) AND
Ref(L,-4)>= Ref(L,-2),Ref(L,-2),If(L>Ref(H,-1)*1.0013,Ref(H,-1)*0.9945,
If(L>PREV*1.1,PREV*1.05,PREV)));
trail:=If(H>PREV AND Ref(H,-1)>PREV,Max(PREV,support),If(H< PREV AND Ref(H,-1)< PREV,
Min(PREV,resistance),If(C>PREV,support,resistance) ));
trail
Resistance trailing stop
To complete Tr&nds, it is necessary to define the formula for the downtrend move. One
possibility is to use the same rules for the downtrend as for the uptrend. Now, do we
want a very close trailing stop for the downtrend, considering we only want to trade
long positions?
Making money during medium- and longer-term downtrends, trading only long positions, is
very unlikely. We probably are much better off just staying out of long trades during
the medium-term downtrends.
The short-term up reactions will create buy signals and if we used a closer-tracking
trailing stop, we will surely lose money. So I prefer to use the modified ATR trailing
stop to keep me out of the trade as long as the price is in a medium-term downtrend.
The "_resistance" formula then becomes:
{_resistance formula}
period:=Input("ATR Period :",1,100,10);
atrfact:=Input("ATR multiplication :",1,10,2.8);
HiLo:=If(H-L<1.5*Mov(H-L,period,S),H-L, 1.5*Mov(H-L,period,S));
Href:=If(L<=Ref(H,-1),H-Ref(C,-1),(H-Ref(C,-1))-(L-Ref(H,-1))/2);
Lref:=If(H>=Ref(L,-1),Ref(C,-1)-L,(Ref(C,-1)-L)-(Ref(L,-1)-H)/2);
diff1:=Max(HiLo,Href);
diff2:=Max(diff1,Lref);
ATRmod:=Wilders(diff2,period);
loss:=atrfact*ATRmod;
resistance:= C + loss;
Bringing it all together in one formula results in the Tr&nds trailing-stop function:
{SVE_TRENDS_Trail trailing stop function}
atrfact:=Input("ATR multiplication :",1,10,2.8);
period:=Input("ATR Period :",1,100,10);
HiLo:=If(H-L<1.5*Mov(H-L,period,S),H-L, 1.5*Mov(H-L,period,S));
Href:=If(L<=Ref(H,-1),H-Ref(C,-1),(H-Ref(C,-1))-(L-Ref(H,-1))/2);
Lref:=If(H>=Ref(L,-1),Ref(C,-1)-L,(Ref(C,-1)-L)-(Ref(L,-1)-H)/2);
diff1:=Max(HiLo,Href);
diff2:=Max(diff1,Lref);
ATRmod:=Wilders(diff2,period);
loss:=atrfact*ATRmod;
resistance:= C + loss;
support:=If(L>=Ref(L,-2) AND Ref(L,-1)>=Ref(L,-2) AND Ref(L,-3)>=Ref(L,-2) AND
Ref(L,-4)>= Ref(L,-2),Ref(L,-2),If(L>Ref(H,-1)*1.0013,Ref(H,-1)*0.9945,
If(L>PREV*1.1,PREV*1.05,PREV)));
trends:=If(H>PREV AND Ref(H,-1)>PREV,Max(PREV,support),If(H< PREV AND Ref(H,-1)< PREV,
Min(PREV,resistance),If(H>=PREV,support,resistance )));
trends
The SVE_Trends_Trail_Date formula can be found in the sidebar "SVE Trends Trail Date"
as follows:
SVE Trends Trail Date for MetaStock
{TR&NDS trailing stop from start date: SVE_Trends_Trail_Date}
InpMonth:=Input("Month",1,12,8);
InpDay:=Input("Day",1,31,16);
InpYear:=Input("Year",1800,2050,2004);
InitStop:=Input("Initial Stop Price",0.1,10000,9);
Support:=If(L>=Ref(L,-2) AND Ref(L,-1)>=Ref(L,-2) AND Ref(L,-3)>=Ref(L,-2) AND
Ref(L,-4)>= Ref(L,-2),Ref(L,-2), If(L>Ref(H,-1)*1.0013,Ref(H,-1)*0.9945,
If(L>PREV*1.1,PREV*1.05, PREV)));
Entry:= InpYear=Year() AND InpMonth=Month() AND InpDay=DayOfMonth();
StopLong:=ExtFml("AdvancedStop.StopLong",Entry,Ini tStop,0,Support-(H-L),0,0,0,0);
StopLong
Þu anda 1 kullanýcý bu konuyu görüntülüyor. (0 kayýtlý ve 1 misafir)