Pagina 1 van 1

Mesa Sine Wave

BerichtGeplaatst: za 30 dec 2006, 11:20
door Scuderia2006
Beste forumleden,

Sinds afgelopen week heb ik eveneens de beschikking over de Vestic software. Ik ben de software nu aan het afstellen aan mijn wensen.
Graag zou ik gebruik maken van de Mesa Sine Wave strategie of handelssysteem, zoals deze in Metastock voorkomt.
Ik wil deze strategie graag gebruik voor de daghandel van aandelen. Deze strategie genereert volgens mij veelvuldig koop en verkoopsignalen.
Zou iemand mij kunnen helpen om onderstaande code (als het dat is) geschikt te maken voor Vestics? Mochten er betere daytrading systemen beschikbaar zijn hoor ik dat natuurlijk ook graag.

Code: Selecteer alles
Performance Systems
MESA Sine Wave
Trading signals for <Name> (<Symbol>) on <Date>

WriteIf(a:=MESALeadSine(2)<MESASineWave(2);b:=MESALeadSine(2)>MESASineWave(2);
state:=If(BarsSince(a)<BarsSince(b),1,0);
state>Ref(state,-1),"If trading short positions, exit all short positions today with a Market On Close (MOC) order or at the market price on tomorrow's open.

If trading long positions, enter long today with a Market On Close (MOC) order or at the market price on tomorrow's open. ")\
\
WriteIf(a:=MESALeadSine(2)<MESASineWave(2);b:=MESALeadSine(2)>MESASineWave(2);
state:=If(BarsSince(a)<BarsSince(b),1,0);
state<Ref(state,-1),"If trading long positions, exit all long positions today with a Market On Close (MOC) order or at the market price on tomorrow's open.

If trading short positions, enter short today with a Market On Close (MOC) order or at the market price on tomorrow's open. ")\
\
WriteIf(a:=MESALeadSine(2)<MESASineWave(2);b:=MESALeadSine(2)>MESASineWave(2);
state:=If(BarsSince(a)<BarsSince(b),1,0);
state=Ref(state,-1),"No trading signals today.")

BerichtGeplaatst: za 30 dec 2006, 22:28
door willie
misschien is dit wat je bedoelt.

gr.

willie


===========
Sine Wave Indicator by John Ehlers


Typ : Indicator, Name : Sine Wave Indicator

Inputs:
Price((H+L)/2);

Vars:
InPhase(0),
Quadrature(0),
Phase(0),
DeltaPhase(0),
count(0),
InstPeriod(0),
Period(0),
DCPhase(0),
RealPart(0),
ImagPart(0);

If CurrentBar > 5 then begin

{Compute InPhase and Quadrature components}
Value1 = Price - Price[6];
Value2 =Value1[3];
Value3 =.75*(Value1 - Value1[6]) + .25*(Value1[2] - Value1[4]);
InPhase = .33*Value2 + .67*InPhase[1];
Quadrature = .2*Value3 + .8*Quadrature[1];

{Use ArcTangent to compute the current phase}
If AbsValue(InPhase +InPhase[1]) > 0 then Phase =
ArcTangent(AbsValue((Quadrature+Quadrature[1]) / (InPhase+InPhase[1])));

{Resolve the ArcTangent ambiguity}
If InPhase < 0 and Quadrature > 0 then Phase = 180 - Phase;
If InPhase < 0 and Quadrature < 0 then Phase = 180 + Phase;
If InPhase > 0 and Quadrature < 0 then Phase = 360 - Phase;

{Compute a differential phase, resolve phase wraparound, and limit delta phase errors}
DeltaPhase = Phase[1] - Phase;
If Phase[1] < 90 and Phase > 270 then DeltaPhase = 360 + Phase[1] - Phase;
If DeltaPhase < 1 then DeltaPhase = 1;
If DeltaPhase > 60 then Deltaphase = 60;

{Sum DeltaPhases to reach 360 degrees. The sum is the instantaneous period.}
InstPeriod = 0;
Value4 = 0;
For count = 0 to 40 begin
Value4 = Value4 + DeltaPhase[count];
If Value4 > 360 and InstPeriod = 0 then begin
InstPeriod = count;
end;
end;

{Resolve Instantaneous Period errors and smooth}
If InstPeriod = 0 then InstPeriod = InstPeriod[1];
Value5 = .25*InstPeriod + .75*Value5[1];

{Compute Dominant Cycle Phase, Sine of the Phase Angle, and Leadsine}
Period = IntPortion(Value5);
RealPart = 0;
ImagPart = 0;
For count = 0 To Period - 1 begin
RealPart = RealPart + Sine(360 * count / Period) * (Price[count]);
ImagPart = ImagPart + Cosine(360 * count / Period) * (Price[count]);
end;
If AbsValue(ImagPart) > 0.001 then DCPhase = Arctangent(RealPart / ImagPart);
If AbsValue(ImagPart) <= 0.001 then DCPhase = 90 * Sign(RealPart);

DCPhase = DCPhase + 90;
If ImagPart < 0 then DCPhase = DCPhase + 180;
If DCPhase > 315 then DCPhase = DCPhase - 360;

Plot1(Sine(DCPhase), "Sine");
Plot2(Sine(DCPhase + 45), "LeadSine");

end;

BerichtGeplaatst: zo 31 dec 2006, 13:33
door Scuderia2006
:D Hey super. Dit gaat de goede richting op.

Bij Metastock staat deze indicator vermeld als een 'expert' functie.
Hij genereert dan koop en verkoopsignalen.
Zou het mogelijk zijn om van deze indicator een handelssysteem te maken die deze signalen ook genereert?
Zoals gezegd wil ik hem graag gebruiken in de daghandel.
Alvast bedankt voor de reactie.