COSTRUZIONE INDICATORE PER ANALISI CICLICA CON VISUAL TRADER (6 lettori)

NAKATA

Nuovo forumer
Var: miavar(0),Miacondizione1,Miacondizione2,Miacondizione3,Miacondizione4,Miacondizione5,Miacondizione6;
Var: Miacondizione7,Miacondizione8, Miacondizione9,Miacondizione10,Miacondizione11,Miacondizione12, Miacondizione13,Miacondizione14;
Var: Miacondizione15,Miacondizione16,Miacondizione17,Miacondizione18,STOP;
Var: Semaforo0910(0), semaforo1010(0), semaforo1110(0), Semaforo1210(0), semaforo1310(0), semaforo1410(0),Semaforo1510(0), semaforo1610(0), semaforo1710(0);
Var: ultimaposizione(0), indzona1(0), valoreritracciamento(0), valore(0), ultimoprezzo(0), barra(0), ope1(0), min1(0), max1(0), clo1(0), ritracciamentocalcolato(0);
Var: miavel, mio10, vettorestop(0), pippo(0), vettoreposizione(0),e,MioHight,MioLow,valorerientr o;

//installtrailingprofit (inperc,0.8,0.1,trailing);
InstalltakeProfit(INPERC, 0.75, "take");
MioHight = HHV(REF(H,4),1);
MioLow = LLV(REF(L,4),1);
//************************************************** ************************************************** ************
if T = 0910 then Miacondizione1 = C+20; Miacondizione2 = C-20; endif;
if T = 1010 then Miacondizione3 = C+20; Miacondizione4 = C-20; endif;
if T = 1110 then Miacondizione5 = C+20; Miacondizione6 = C-20; endif;
if T = 1210 then Miacondizione7 = C+20; Miacondizione8 = C-20; endif;
if T = 1310 then Miacondizione9 = C+20; Miacondizione10= C-20; endif;
if T = 1410 then Miacondizione11= C+20; Miacondizione12= C-20; endif;
if T = 1510 then Miacondizione13 =C+20; Miacondizione14= C-20; endif;
if T = 1610 then Miacondizione15 =C+20; Miacondizione16= C-20; endif;
if T = 1710 then Miacondizione17 =C+20; Miacondizione18= C-20; endif;
//************************************************** ************************************************** *********************
//Non si riesce a capire perche ma se metto il controllo in T = non lo prende, probabilmente perche delle barre potrebbero mancare
//in assenza di contrattazione
if T >=0910 and T <= 1009 then if positiondir = 1 then semaforo0910 = 1; endif; if positiondir = - 1 then semaforo0910 = - 1; endif; endif;
if T >=1010 and T <= 1109 then if positiondir = 1 then semaforo1010 = 1; endif; if positiondir = - 1 then semaforo1010 = - 1; endif; endif;
if T >=1110 and T <= 1209 then if positiondir = 1 then semaforo1110 = 1; endif; if positiondir = - 1 then semaforo1110 = - 1; endif; endif;
if T >=1210 and T <= 1309 then if positiondir = 1 then semaforo1210 = 1; endif; if positiondir = - 1 then semaforo1210 = - 1; endif; endif;
if T >=1310 and T <= 1409 then if positiondir = 1 then semaforo1310 = 1; endif; if positiondir = - 1 then semaforo1310 = - 1; endif; endif;
if T >=1410 and T <= 1509 then if positiondir = 1 then semaforo1410 = 1; endif; if positiondir = - 1 then semaforo1410 = - 1; endif; endif;
if T >=1510 and T <= 1609 then if positiondir = 1 then semaforo1510 = 1; endif; if positiondir = - 1 then semaforo1510 = - 1; endif; endif;
if T >=1610 and T <= 1709 then if positiondir = 1 then semaforo1610 = 1; endif; if positiondir = - 1 then semaforo1610 = - 1; endif; endif;
if T >=1710 and T <= 1730 then if positiondir = 1 then semaforo1710 = 1; endif; if positiondir = - 1 then semaforo1710 = - 1; endif; endif;
//************************************************** ************************************************** ***************************************
//Identifica il livello del ritracciamento
//Con vettoreposizione mi salvo la posizione del sistema in ogni barra
//Se la posizione attuale è flat e la precedente era long e lastopisstop = true vuole dire (fino a quando non attiviamo lo stoploss che
//è uscito in trailing
vettoreposizione = positiondir;
if vettoreposizione = 0 and vettoreposizione[1] = 1 and LastopIsStop = true then valoreritracciamento = valexit;
if (CompareTime(09, 10, 0) > 0) and (CompareTime(10,09, 0) < 0) then Miacondizione1 = valexit + 10; semaforo0910 = 0; endif;
if (CompareTime(10, 10, 0) > 0) and (CompareTime(11,09, 0) < 0) then Miacondizione3 = valexit + 10; semaforo1010 = 0; endif;
if (CompareTime(11, 10, 0) > 0) and (CompareTime(12,09, 0) < 0) then Miacondizione5 = valexit + 10; semaforo1110 = 0; endif;
if (CompareTime(12, 10, 0) > 0) and (CompareTime(13,09, 0) < 0) then Miacondizione7 = valexit + 10; semaforo1210 = 0; endif;
if (CompareTime(13, 10, 0) > 0) and (CompareTime(14,09, 0) < 0) then Miacondizione9 = valexit + 10; semaforo1310 = 0; endif;
if (CompareTime(14, 10, 0) > 0) and (CompareTime(15,09, 0) < 0) then Miacondizione11= valexit + 10; semaforo1410 = 0; endif;
if (CompareTime(15, 10, 0) > 0) and (CompareTime(16,09, 0) < 0) then Miacondizione13= valexit + 10; semaforo1510 = 0; endif;
if (CompareTime(16, 10, 0) > 0) and (CompareTime(17,09, 0) < 0) then Miacondizione15= valexit + 10; semaforo1610 = 0; endif;
if (CompareTime(17, 10, 0) > 0) and (CompareTime(17,30, 0) < 0) then Miacondizione17= valexit + 10; semaforo1710 = 0; endif;
endif;
if vettoreposizione = 0 and vettoreposizione[1] = -1 and LastopIsStop = true then valoreritracciamento = valexit;
if (CompareTime(09, 10, 0) > 0) and (CompareTime(10,09, 0) < 0) then Miacondizione2 = valexit - 10; semaforo0910 = 0; endif;
if (CompareTime(10, 10, 0) > 0) and (CompareTime(11,09, 0) < 0) then Miacondizione4 = valexit - 10; semaforo1010 = 0; endif;
if (CompareTime(11, 10, 0) > 0) and (CompareTime(12,09, 0) < 0) then Miacondizione6 = valexit - 10; semaforo1110 = 0; endif;
if (CompareTime(12, 10, 0) > 0) and (CompareTime(13,09, 0) < 0) then Miacondizione8 = valexit - 10; semaforo1210 = 0; endif;
if (CompareTime(13, 10, 0) > 0) and (CompareTime(14,09, 0) < 0) then Miacondizione10= valexit - 10; semaforo1310 = 0; endif;
if (CompareTime(14, 10, 0) > 0) and (CompareTime(15,09, 0) < 0) then Miacondizione12= valexit - 10; semaforo1410 = 0; endif;
if (CompareTime(15, 10, 0) > 0) and (CompareTime(16,09, 0) < 0) then Miacondizione14= valexit - 10; semaforo1510 = 0; endif;
if (CompareTime(16, 10, 0) > 0) and (CompareTime(17,09, 0) < 0) then Miacondizione16= valexit - 10; semaforo1610 = 0; endif;
if (CompareTime(17, 10, 0) > 0) and (CompareTime(17,30, 0) < 0) then Miacondizione18= valexit - 10; semaforo1710 = 0; endif;
endif;
//************************************************** ************************************************** **********************************************
if (CompareTime(09, 10, 0) > 0) and (CompareTime(10,09, 0) < 0) then
if C > Miacondizione1 and semaforo0910 <> 1 and C > MioHight and C > C[1] then EnterLong(NextBar, AtOpen); semaforo0910 = 1; endif;
if C < Miacondizione2 and semaforo0910 <> -1 and C < MioHight and C < C[1]then EnterShort(NextBar,AtOpen); semaforo0910 = -1; endif;
endif;
if (CompareTime(10, 10, 0) > 0) and(CompareTime(11,09, 0) < 0) then
if C > Miacondizione3 and semaforo1010 <> 1 and C > MioHight and C > C[1] then EnterLong(NextBar, AtOpen); semaforo1010 = 1; endif;
if C < Miacondizione4 and semaforo1010 <> -1 and C < MioHight and C < C[1] then EnterShort(NextBar,AtOpen); semaforo1010 = -1; endif;
endif;
if (CompareTime(11, 10, 0) > 0) and (CompareTime(12,09, 0) < 0) then
if C > Miacondizione5 and semaforo1110 <> 1 and C > MioHight and C > C[1] then EnterLong(NextBar, AtOpen); semaforo1110 = 1; endif;
if C < Miacondizione6 and semaforo1110 <> -1 and C < MioHight and C < C[1] then EnterShort(NextBar,AtOpen); semaforo1110 = -1; endif;
endif;
if (CompareTime(12, 10, 0) > 0) and (CompareTime(13,09, 0) < 0) then
if C > Miacondizione7 and semaforo1210 <> 1 and C > MioHight and C > C[1] then EnterLong(NextBar, AtOpen); semaforo1210 = 1; endif;
if C < Miacondizione8 and semaforo1210 <> -1 and C < MioHight and C < C[1] then EnterShort(NextBar,AtOpen); semaforo1210 = -1; endif;
endif;
if (CompareTime(13, 10, 0) > 0) and (CompareTime(14,09, 0) < 0) then
if C > Miacondizione9 and semaforo1310 <> 1 and C > MioHight and C > C[1] then EnterLong(NextBar, AtOpen); semaforo1310 = 1; endif;
if C < Miacondizione10 and semaforo1310 <>-1 and C < MioHight and C < C[1] then EnterShort(NextBar,AtOpen); semaforo1310 = -1;endif;
endif;
if (CompareTime(14, 10, 0) > 0) and (CompareTime(15,09, 0) < 0) then
if C > Miacondizione11 and semaforo1410 <> 1 and C > MioHight and C > C[1]then EnterLong(NextBar, AtOpen); semaforo1410 = 1; endif;
if C < Miacondizione12 and semaforo1410 <>-1 and C < MioHight and C < C[1]then EnterShort(NextBar,AtOpen); semaforo1410 = -1;endif;
endif;
if (CompareTime(15, 10, 0) > 0) and (CompareTime(16,09, 0) < 0) then
if C > Miacondizione13 and semaforo1510 <> 1 and C > MioHight and C > C[1] then EnterLong(NextBar, AtOpen); semaforo1510 = 1; endif;
if C < Miacondizione14 and semaforo1510 <>-1 and C < MioHight and C < C[1] then EnterShort(NextBar,AtOpen); semaforo1510 = -1; endif;
endif;
if (CompareTime(16, 10, 0) > 0) and (CompareTime(17,09, 0) < 0) then
if C > Miacondizione15 and semaforo1610 <> 1 and C > MioHight and C > C[1] then EnterLong(NextBar, AtOpen); semaforo1610 = 1; endif;
if C < Miacondizione16 and semaforo1610 <>-1 and C < MioHight and C < C[1] then EnterShort(NextBar,AtOpen); semaforo1610 = -1; endif;
endif;
if (CompareTime(17, 10, 0) > 0) and (CompareTime(17,30, 0) < 0) then
if C > Miacondizione17 and semaforo1710 <> 1 and C > MioHight and C > C[1] then EnterLong(NextBar, AtOpen); semaforo1710 = 1; endif;
if C < Miacondizione18 and semaforo1710 <>-1 and C < MioHight and C < C[1] then EnterShort(NextBar, AtOpen);semaforo1710 = -1; endif;
endif;
//************************************************** ************************************************** *if t>=1732 then
if t>=1732 then
if positiondir=1 then
exitlong(bar,atclose);
endif;
if positiondir=-1 then
exitshort(bar,atclose);
endif;
endif;
if T >=0910 and T <= 1730 and vettoreposizione[1] = 1 and LastopIsStop = true then valorerientro = valexit-10; endif;
if T >=0910 and T <= 1730 and vettoreposizione[1] = -1 and LastopIsStop = true then valorerientro = valexit+10; endif;
PlotChart(valoreritracciamento,0,red,solid,2);
plotChart(valorerientro,0,green,solid,2);---------------------------------ora ho sistemato le parole staccate ma mi da questo errore------Verifica Formula ... Errore
Linea 7: Errore di sintassi: Mi aspetto i seguenti token: ( , ;------non vorrei disturbarvi troppo ....mi potete rispondere anche a borsa chiusa ve ne sarei molto grato
 

bernese

Nuovo forumer
Cosa ti avevo detto ,linea 6 lui ti da linea 7 ma solo per indicarti che l'errore è sopra,unisci l'ultima parola"VALORERIENTRO"
 

NAKATA

Nuovo forumer
Ho risolto il problema ora la formula e'ok.Si ho la versione beta 16 ma siete sicuri che questa e' la formula del supertrend. La vedo diversa. L'ho confrontata con la supertrend che sta sul sito T3 (intesatrade) ma non e' uguale.
 

Ciclone21

Forumer attivo
Scasami nakata. Ho postato la formula ciclone, tu chiedevi la supertrend! La trovi andando indietro in queste pagine!

Di nuovo scusa
 

Ciclone21

Forumer attivo
Ecco la Supertrend come la conosco io!

{******************************************************************************
* SuperTrend.
* Aggiungere in questo punto i Vostri commenti, che vi aiuteranno
* in seguito a ricordare le linee guida di trading che intendete
* automatizzare .
******************************************************************************}
Var: super,flag,flagh,mioatr,miocci,mrange,st(0),molt(3),trendup,trenddown,indzona1,trend(1),changetrend;
mioatr=atr(c,10);
trendup=avgprice+(molt*mioatr);
trenddown=avgprice-(molt*mioatr);
if c>trendup[1] then
trend=1;
else
if c<trenddown[1] then
trend=-1;
endif;
endif;
if trend<0 and trend[1]>0 then
flag=1;
else
flag=0;
endif;
if trend>0 and trend[1]<0 then
flagh=1;
else
flagh=0;
endif;
if trend>0 and trenddown<trenddown[1] then
trenddown=trenddown[1];
endif;
if trend<0 and trendup>trendup[1] then
trendup=trendup[1];
endif;
if flag=1 then
trendup=avgprice+(molt*mioatr);
endif;
if flagh=1 then
trenddown=avgprice-(molt*mioatr);
endif;
if trend=1 then
super=trenddown;
else
super=trendup;
endif;
PlotChart(super, 0, green, solid, 3);
 

Ciclone21

Forumer attivo
Pongo una nuova domanda.

Devo trovare il valore più alto della formula V/(H-L) nelle ultime 20 barre. Come faccio?

Grazie,

Ciclone
 

Users who are viewing this thread

Alto