Home Page di InvestireOggi
Le ultime
NEWS
FINANZIARIE
Quotazioni e Grafici E.o.D. Real Time
FTSE Mib
13.057
-50.5

Rispondi
 
Strumenti discussione Cerca in questa discussione
Vecchio 08-08-2011, 12:03   #1 (permalink)
Almost Jazz Pianist
 
L'avatar di superbaffone
 
Data registrazione: Aug 2004
Località: Fiji
Messaggi: 11,613
Schaff trend cycle visualtrader

qualcuno è in grado di trasformare la formula per amibroker in formula per visualtrader?

/*
Ported directly from original STC Tradestation code
results differ from other Amibroker versions that are not based directly on original EasyLanguage code
http://mediaserver.fxstreet.com/Repo...9f4ab77c00.pdf
*/
MA1=23;
MA2=50;
TCLen=10;
MA1=Param("ShortMACDLen",23,5,36);
MA2=Param("LOngMACDLen",50,10,100);
TCLen=Param("TCLen(StochPeriod)",10,5,20);
Factor=.5;
//Calculate a MACD Line
XMac = MACD(MA1,MA2) ; // MACD in Amibroker always uses Close for MACD calculation

//1st Stochastic: Calculate Stochastic of a MACD
Value1 = LLV(XMac, TCLen);
Value2 = HHV(XMac, TCLen) - Value1;

//Frac1=1; // prime Frac1 to a default of 1
//Frac1 = IIf(Value2 > 0, ((XMac - Value1) / Value2) * 100, Ref(FRAC1,-1));
// have to "prime" first value so that reference to "i-1" does not result in subscript out of range
// since MACD for both periods is not defined until MA2 period, 0 seems to be mathematically correct priming value
frac1=0;
for (i = 1; i < BarCount; i++) {
if (Value2[i] > 0) {
frac1[i] = ((XMac[i] - Value1[i])/Value2[i])*100;
}
else {
frac1[i]= frac1[i-1];
}
}

//Smoothed calculation for %FastD of MACD

PF[0]=frac1[0];
PF[1]=frac1[1];
for (i = 2; i < BarCount; i++) {
PF[i]=PF[i-1]+(Factor*(frac1[i]-PF[i-1]));
}


//2nd Stochastic: Calculate Stochastic of Smoothed Percent FastD, above.
Value3 = LLV(PF, TCLen);
Value4 = HHV(PF, TCLen) - Value3;

//%FastK of PF
/*
Frac2=1;
Frac2 = IIf(Value4 > 0, ((PF - Value3) / Value4) * 100, Ref(FRAC2,-1));
*/

frac2[0]=0;
for (i = 1; i < BarCount; i++) {
if (Value4[i] > 0 ) {
frac2[i]=((PF[i] - Value3[i])/Value4[i])*100;
}
else {
frac2[i]=frac2[i-1];
}
}

//Smoothed calculation for %FastD of PF
PFF[0]=frac2[0];
PFF[1]=frac2[1];
for (i = 2; i < BarCount; i++) {
PFF[i]=PFF[i-1]+(Factor*(frac2[i]-PFF[i-1]));
}

Plot(pff,"STLC",colorRed,styleLine);
Plot(75,"",colorBlue,styleLine|styleDashed);
Plot(25,"",colorYellow,styleLine|styleDashed);
superbaffone non è connesso   Rispondi citando
Avviso pubblicitario - i seguenti Banner Pubblicitari permettono al sito di offrirvi il consueto, alto standard qualitativo.
 
Vecchio 08-08-2011, 12:07   #2 (permalink)
Almost Jazz Pianist
 
L'avatar di superbaffone
 
Data registrazione: Aug 2004
Località: Fiji
Messaggi: 11,613
metastock

Schaff Trend Cycle Oscillator

{ Schaff Trend Cycle Oscillator v1.0 }{ Automatic trigger levels }{ Also see: "MACD oscillator - Schaff Trend Cycle" }{ josesilva22@yahoo.com }{ With thanks to Tim Straiton, www.stoploss.ch }

{ variables input }
pdsCy:=Input("Schaff cycle periods",2,252,10);
pdsSh:=Input("Short periods",1,252,10);
pdsLg:=Input("Long periods",2,2520,21);

{ Schaff Trend Cycle }
MCD:=Wilders(MP(),pdsSh)-Wilders(MP(),pdsLg);
ST:=(MCD-LLV(MCD,pdsCy))
/(HHV(MCD,pdsCy)-LLV(MCD,pdsCy))*100;
STC:=Wilders(ST,pdsCy/2);

{ automatic trigger levels }
pk:=Ref(STC,-1)>STC AND Ref(STC,-1)>Ref(STC,-2);
pkVal:=If(pk,Ref(STC,-1),0);
pkAvg:=Cum(pkVal)/(Cum(pk)+.000001);
pkAvg:=If(pkAvg=0,100,pkAvg);
tr:=Ref(STC,-1)<STC AND Ref(STC,-1)<Ref(STC,-2);
trVal:=If(tr,Ref(STC,-1),0);
trAvg:=Cum(trVal)/(Cum(tr)+.000001);

{ plot on own window }
pkAvg;trAvg;STC

Schaff Trend Cycle Indicator

{ Schaff Trend Cycle Indicator v1.0 }{ Automatic trigger levels }{ Also see: "MACD oscillator - Schaff Trend Cycle" }{ josesilva22@yahoo.com }{ With thanks to Tim Straiton, www.stoploss.ch }

{ variables input }
buffer:=Input("Long/Short buffer zone %",
0,100,0)/100;
pdsCy:=Input("Schaff cycle periods",2,252,10);
pdsSh:=Input("Short periods",1,252,10);
pdsLg:=Input("Long periods",2,2520,21);

{ Schaff Trend Cycle }
MCD:=Wilders(MP(),pdsSh)-Wilders(MP(),pdsLg);
ST:=(MCD-LLV(MCD,pdsCy))
/(HHV(MCD,pdsCy)-LLV(MCD,pdsCy))*100;
STC:=Wilders(ST,pdsCy/2);

{ Schaff Trend Cycle }
MCD:=Wilders(MP(),pdsSh)-Wilders(MP(),pdsLg);
ST:=(MCD-LLV(MCD,pdsCy))
/(HHV(MCD,pdsCy)-LLV(MCD,pdsCy))*100;
STC:=Wilders(ST,pdsCy/2);

{ automatic trigger levels }
pk:=Ref(STC,-1)>STC AND Ref(STC,-1)>Ref(STC,-2);
pkVal:=If(pk,Ref(STC,-1),0);
pkAvg:=Cum(pkVal)/(Cum(pk)+.000001);
pkAvg:=If(pkAvg=0,100,pkAvg);
tr:=Ref(STC,-1)<STC AND Ref(STC,-1)<Ref(STC,-2);
trVal:=If(tr,Ref(STC,-1),0);
trAvg:=Cum(trVal)/(Cum(tr)+.000001);

{ STC crossover signals }
In:=Cross(pkAvg,STC);
Out:=Cross(STC,trAvg);
InInit:=Cum(In)=1;
Init:=Cum(In+Out>-1)=1;
flag:=BarsSince(Init OR In)
< BarsSince(Init OR Out)+InInit;
signals:=(InInit AND Alert(InInit=0,2)
OR flag AND Alert(flag=0,2))
-(flag=0 AND Alert(flag,2));

{ trend support/resistance levels }
STCI:=If(flag,ValueWhen(1,signals,L*(1-buffer)),
ValueWhen(1,signals=-1 OR Init,H*(1+buffer)));

{ alternative STC crossover signals method}
{bb:=BarsSince(Cross(STC,trAvg));
bs:=BarsSince(Cross(pkAvg,STC));
tb:=ValueWhen(1,Cross(STC,trAvg),H*(1+buffer));
ts:=ValueWhen(1,Cross(pkAvg,STC),L*(1-buffer));
STCI:=If(bb<bs,tb,ts);}

{ plot on price chart }
STCI
(Go Top...)
superbaffone non è connesso   Rispondi citando
Vecchio 11-08-2011, 00:50   #3 (permalink)
eka
Forumer attivo
 
Data registrazione: Jul 2010
Località: torino
Messaggi: 93
Cercavo esattamente la stessa cosa!
eka non è connesso   Rispondi citando
Vecchio 16-08-2011, 23:15   #4 (permalink)
Utente Senior
 
L'avatar di atreyu
 
Data registrazione: Apr 2009
Messaggi: 116
ci ho lavorato un pochino prendendo la formula MT e sono arrivato qui, ma da errore sulla riga :

Value3 = LLV(PF, TCLen);
Value4 = HHV(PF, TCLen) - Value3;

perche' al posto di PF si aspetta un oscillatore, ma non so come risolvere la faccenda.

Lascio qui perce' qualcuno possa prendere il testimone e portalo al traguardo!



Input: TCLen(10), MA1(23), MA2(50);
//Input: TCLen(NumericSimple), MA1(NumericSimple), MA2(NumericSimple);

Var: XMac(0), Frac1(0), PF(0), PFF(0), Frac2(0), Factor(.5),
value1, value2, value3, value4, SchaffTC;

{Calculate a MACD Line}
XMac = MACD(c,MA1,MA2) ;

{1st Stochastic: Calculate Stochastic of a MACD}
Value1 = LLV(XMac, TCLen);
Value2 = HHV(XMac, TCLen) - Value1;

{%FastK of MACD}
Frac1 = IIF(Value2 > 0, ((XMac - Value1) / Value2) * 100, Frac1[1]);

{Smoothed calculation for %FastD of MACD}
PF = IIF(CurrentBar<=1, Frac1, PF[1] + (Factor * (Frac1 - PF[1])) );

{2nd Stochastic: Calculate Stochastic of Smoothed Percent FastD, ‘PF’, above.}
Value3 = LLV(PF, TCLen);
Value4 = HHV(PF, TCLen) - Value3;

{%FastK of PF}
Frac2 = IIF(Value4 > 0, ((PF - Value3) / Value4) * 100, Frac2[1]);

{Smoothed calculation for %FastD of PF}
PFF = IIF(CurrentBar<=1, Frac2, PFF[1] + (Factor * (Frac2 - PFF[1])));

{The STC function is the %FastD of PF}
//SchaffTC= PFF;
__________________
Se i fatti e la teoria non concordano, lo stupido cambia i fatti.
A.Einstein
atreyu non è connesso   Rispondi citando
Vecchio 17-08-2011, 08:12   #5 (permalink)
Utente Senior
 
Data registrazione: Feb 2011
Messaggi: 109
nella beta 5.4 basta mettere
Codice:
Input: TCLen(10), MA1(23), MA2(50);
//Input: TCLen(NumericSimple), MA1(NumericSimple), MA2(NumericSimple);

Var: XMac(0), Frac1(0), PF(0), PFF(0), Frac2(0), Factor(.5),
value1, value2, value3, value4, SchaffTC;

SETCALCOSCARRAY(true);

{Calculate a MACD Line}
XMac = MACD(c,MA1,MA2) ;

{1st Stochastic: Calculate Stochastic of a MACD}
Value1 = LLV(XMac, TCLen);
Value2 = HHV(XMac, TCLen) - Value1;

{%FastK of MACD}
Frac1 = IIF(Value2 > 0, ((XMac - Value1) / Value2) * 100, Frac1[1]);

{Smoothed calculation for %FastD of MACD}
PF = IIF(CurrentBar<=1, Frac1, PF[1] + (Factor * (Frac1 - PF[1])) );

{2nd Stochastic: Calculate Stochastic of Smoothed Percent FastD, ‘PF’, above.}
Value3 = LLV(PF, TCLen);
Value4 = HHV(PF, TCLen) - Value3;

{%FastK of PF}
Frac2 = IIF(Value4 > 0, ((PF - Value3) / Value4) * 100, Frac2[1]);

{Smoothed calculation for %FastD of PF}
PFF = IIF(CurrentBar<=1, Frac2, PFF[1] + (Factor * (Frac2 - PFF[1])));

plotchartNoZero(PFF, 1, red, solid, 1);
100pezzi non è connesso   Rispondi citando
Vecchio 17-08-2011, 08:54   #6 (permalink)
Utente Senior
 
L'avatar di atreyu
 
Data registrazione: Apr 2009
Messaggi: 116
grazie 100pezzi!

allora devo installare la 5.4.

Ho provato dalla sezione info di VT ma non mi fa' vedere nulla.

Dove l'hai trovata?
__________________
Se i fatti e la teoria non concordano, lo stupido cambia i fatti.
A.Einstein
atreyu non è connesso   Rispondi citando
Vecchio 17-08-2011, 12:39   #7 (permalink)
Utente Senior
 
Data registrazione: Feb 2011
Messaggi: 109
ho chiesto nella sezione betatest direttamente dal menu INFO di vt
ciao
100pezzi non è connesso   Rispondi citando
Vecchio 17-08-2011, 21:42   #8 (permalink)
Utente Senior
 
L'avatar di atreyu
 
Data registrazione: Apr 2009
Messaggi: 116
esatto come avevo fatto io, probabilmente in questi gionri non e' disponbile,
riprovero' nei giorni prossimi
grazie
__________________
Se i fatti e la teoria non concordano, lo stupido cambia i fatti.
A.Einstein
atreyu non è connesso   Rispondi citando
Vecchio 17-08-2011, 21:46   #9 (permalink)
Utente Senior
 
L'avatar di atreyu
 
Data registrazione: Apr 2009
Messaggi: 116
per chi e' interessato allo Schaff Trend Cylcle sara' anche interessato alla media mobile di Hull.

Allora copio il codice VT che uso io:


input:P(15);

Var:demip,temp,racineP,mmhull,demipp;
Var:indzona, lin1, data1, data2, valore1;

demiP=round(p/2,0);
temp=op(op(mov(c,demip,a),constval(2),mul),mov(c,p ,a),sub);
racinep=round(sqrt(p),0);
mmhull=mov(temp,racinep,a);

plotchart(mmhull,0,gray,solid,1);


// per colorare la mm
if mmhull >= mmhull[1] then
DrawCircle (createogg, indzona, GetDate, mmhull , lime, 1, 3);
endif;
if mmhull < mmhull[1] then
DrawCircle (createogg, indzona, GetDate, mmhull , red, 1, 3);
endif;

Che sia utile a qualcuno.
Ciao.
__________________
Se i fatti e la teoria non concordano, lo stupido cambia i fatti.
A.Einstein
atreyu non è connesso   Rispondi citando
Vecchio 25-08-2011, 17:50   #10 (permalink)
Almost Jazz Pianist
 
L'avatar di superbaffone
 
Data registrazione: Aug 2004
Località: Fiji
Messaggi: 11,613
grazie ragazzi nella beta fuziona ma si impalla spesso qualcuno è riuscito a farla girare nella 5.3?
superbaffone non è connesso   Rispondi citando
Rispondi

Segnalibri

« Discussione precedente | Nuova discussione »

Utenti attualmente attivi che stanno leggendo questa discussione: 1 (0 utenti e 1 ospiti)
 
Strumenti discussione Cerca in questa discussione
Cerca in questa discussione:

Ricerca avanzata

Regole messaggi
Tu non puoi inviare nuove discussioni
Tu non puoi replicare
Tu non puoi inviare allegati
Tu non puoi modificare i tuoi messaggi

Il codice BB è Attivato
Le faccine sono Attivato
Il codice [IMG] è Attivato
Il codice HTML è Disattivato
Trackbacks are Attivato
Pingbacks are Attivato
Refbacks are Disattivato


Discussioni simili
Discussione Autore discussione Forum Risposte Ultimo messaggio
S&P500 - FTSE MIB - UNICREDIT: Cycle, Primary, Intermediate (Elliott) - CICLI - A.T. Zuppa o Panebagnato Piazza Affari 61 15-02-2012 21:48
Programmazione Visual Trader
POC su visualtrader
bomberone1 Trading Systems, Econometria 3 11-09-2011 01:11
Programmazione Visual Trader
Gettrailingprofit con VISUALTRADER
BOVARO Trading Systems, Econometria 3 16-04-2011 18:59
Grand Super Cycle !!! cocomi Piazza Affari 10 05-11-2004 20:31
un cycle diagram possibile per l'economia detesca andreabaga Trading School: AT e AF, psicologia, strategie 2 28-05-2002 10:56


Tutti gli orari sono GMT +2. Adesso sono le 20:07.


vBulletin®
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.6.0
(C) Copyright InvestireOggi 2000-2010