Ciao
Ho finalmente cominciato a studiare seriamente l'easylanguage di Tradestation e per esercitarmi ho scritto un indicatore (allegato in fondo) che dovrebbe tracciare uno Swing Chart unendo tutti i min e max relativi.
Il problema che non sono riuscito ancora risolvere è che questo indicatore non mi parte dalla prima barra e non capisco il perchè.
Utilizzando la Debug window ho notato che per un motivo per me incomprensibile ogni x barre le variabili vengono tutte reinizializzate. Ad esempio se scrivo:
print (currentbar);
il risultato sarà:
1
2
3
1
2
3
4
5
..
Sapendo che in questo forum ci sono veri "mostri" di easylanguage spero che qualcuno vorra aiutarmi.
Bye
Variable: LastH(-1),LastL(-1),Dir(0),Tl(0),OldSwing(-1);
LastH=LastH+1;
LastL=LastL+1;
OldSwing=OldSwing+1;
{Print(LastH ",LastH," LastL ",LastL," OldSwing ",OldSwing);}
if (L>=L[LastL] And H<=H[LastH])=false then
Begin
Print("Non Inside ");
if L<L[LastL] and H>H[LastH] then
Begin
if dir=1 then LastH=0;
if dir=-1 then LastL=0;
End
Else
Begin
if L>=L[LastL] and H>H[LastH] then
Begin
if Dir<1 then
Begin
{ Print(Date, " New TL DW "," CurrentBar = ");
Print("OldSwing = ", OldSwing, " LastL = ",LastL);}
Tl=TL_New(Date[OldSwing], Time[OldSwing], H[OldSwing], Date[LastL], Time[LastL], L[LastL]);
OldSwing=LastL;
End;
Dir=1;
End;
if L<L[LastL] and H<=H[LastH] then
Begin
If Dir>-1 then
Begin
{ Print(Date, " New TL UP "," CurrentBar = ");
Print("OldSwing = ", OldSwing, " LastL = ",LastL);}
Tl=TL_New(Date[OldSwing], Time[OldSwing], L[OldSwing], Date[LastL], Time[LastL], H[LastL]);
OldSwing=LastH;
End;
Dir=-1;
End;
LastH=0;
LastL=0;
End;
End;
Ho finalmente cominciato a studiare seriamente l'easylanguage di Tradestation e per esercitarmi ho scritto un indicatore (allegato in fondo) che dovrebbe tracciare uno Swing Chart unendo tutti i min e max relativi.
Il problema che non sono riuscito ancora risolvere è che questo indicatore non mi parte dalla prima barra e non capisco il perchè.
Utilizzando la Debug window ho notato che per un motivo per me incomprensibile ogni x barre le variabili vengono tutte reinizializzate. Ad esempio se scrivo:
print (currentbar);
il risultato sarà:
1
2
3
1
2
3
4
5
..
Sapendo che in questo forum ci sono veri "mostri" di easylanguage spero che qualcuno vorra aiutarmi.
Bye
Variable: LastH(-1),LastL(-1),Dir(0),Tl(0),OldSwing(-1);
LastH=LastH+1;
LastL=LastL+1;
OldSwing=OldSwing+1;
{Print(LastH ",LastH," LastL ",LastL," OldSwing ",OldSwing);}
if (L>=L[LastL] And H<=H[LastH])=false then
Begin
Print("Non Inside ");
if L<L[LastL] and H>H[LastH] then
Begin
if dir=1 then LastH=0;
if dir=-1 then LastL=0;
End
Else
Begin
if L>=L[LastL] and H>H[LastH] then
Begin
if Dir<1 then
Begin
{ Print(Date, " New TL DW "," CurrentBar = ");
Print("OldSwing = ", OldSwing, " LastL = ",LastL);}
Tl=TL_New(Date[OldSwing], Time[OldSwing], H[OldSwing], Date[LastL], Time[LastL], L[LastL]);
OldSwing=LastL;
End;
Dir=1;
End;
if L<L[LastL] and H<=H[LastH] then
Begin
If Dir>-1 then
Begin
{ Print(Date, " New TL UP "," CurrentBar = ");
Print("OldSwing = ", OldSwing, " LastL = ",LastL);}
Tl=TL_New(Date[OldSwing], Time[OldSwing], L[OldSwing], Date[LastL], Time[LastL], H[LastL]);
OldSwing=LastH;
End;
Dir=-1;
End;
LastH=0;
LastL=0;
End;
End;