Formula Pivot Daily in EasyLanguage 	 | 
  
   
    | Autore | 
    Discussione | 
      | 
  
  
   
    Subtrader Membro 
     
    Registrato dal: 
    18/04/2006 
     
    
	Messaggi: 
	6
	 
	 
	   Offline | 
     
      
     | 
           
          | 
  
  
   
     
       
      dusky
       Membro
	   
	   
	  Registrato dal: 
	  11/04/2006 
	   
	  
    Messaggi: 
    8
     
     
      Offline 
 | 
     
      
         
          
            
              | Inviato il : 20/04/2006 - 11:18:52             | 
                
                      
                      
                      
                 | 
             
           
           
		   | 
         
         
          
		   ciao
 vedi se questa ti può servire o se la puoi modificare
 
 http://trader.online.pl/ELZ/t-i-Pivot_Point_Levels.html
 
		   | 
         
       
     | 
    
	
	 | 
  
  
   
     
       
      Subtrader
       Membro
	   
	   
	  Registrato dal: 
	  18/04/2006 
	   
	  
    Messaggi: 
    6
     
     
      Offline 
 | 
     
      
         
          
            
              | Inviato il : 20/04/2006 - 17:56:54             | 
                
                      
                      
                      
                 | 
             
           
           
		   | 
         
         
          
		   Grazieeeee    
		   | 
         
       
     | 
    
	
	 | 
  
  
   
     
       
      Zigarum
       Membro
	   
	   
	  Registrato dal: 
	  05/04/2006 
	   
	  
    Messaggi: 
    1996
     
     
      Offline 
 | 
     
      
         
          
            
              | Inviato il : 20/04/2006 - 20:25:19             | 
                
                      
                      
                      
                 | 
             
           
           
		   | 
         
         
          
		   
 usa questa fai copia incolla , crei un INDICATORE  gli dai il nome e incolli questo.
 
 inputs: 
     StandardColor(Green),
     FirstDate(LastCalcDate),
     NumDays(1),
     PivotType(2);
 
 var:
     ii(0),
     BeginDate(CalcDate(FirstDate,-NumDays+1)),
     EndDate(FirstDate),pDRange(0),pDH(0),pDL(0),pDC(0),pDO(0),LastCalcDateIntended(false),
     Color(0);
 
 var:
     kC1  (  1 ),
     kO0  (  2 ),
     kCP  (  3 ),
     
     kR1  (  4 ),
     kS1  (  5 ),
     
     kR2  (  6 ),
     kS2  (  7 ),
     
     kR3  (  8 ),
     kS3  (  9 ),
     
     kS2S3( 10 ),
     kS1S2( 11 ),
     kCPS1( 12 ),
     kCPR1( 13 ),
     kR1R2( 14 ),
     kR2R3( 15 ),
     kMax ( kR2R3 ); { 15 }
 
 Array:
     LineID   [ 15 ](-1), { should all be kMax }
     SRValue  [ 15 ](-1), 
     TextID   [ 15 ](-1), 
     TextLabel[ 15 ](""); 
 
 If CurrentBar = 1 then Begin 
    TextLabel[ kO0   ] = "open";
    TextLabel[ kC1   ] = "Ch";
    TextLabel[ kCP   ] = "pivot";
    
    TextLabel[ kR1   ] = "R1";
    TextLabel[ kS1   ] = "S1";
    
    TextLabel[ kR2   ] = "R2";
    TextLabel[ kS2   ] = "S2";
    
    TextLabel[ kR3   ] = "R3";
    TextLabel[ kS3   ] = "S3";
 
    TextLabel[ kS2S3 ] = "S2S3";
    TextLabel[ kS1S2 ] = "S1S2";
    TextLabel[ kCPS1 ] = "CPS1";
    TextLabel[ kCPR1 ] = "CPR1";
    TextLabel[ kR1R2 ] = "R1R2";
    TextLabel[ kR2R3 ] = "R2R3";
    LastCalcDateIntended = FirstDate = LastCalcDate;
 end;
 
 
 if false then begin
    { dummy plots to allow user choose their own colors in the standard way }
    plot1(0,"S1R1");
    plot2(0,"S2R2");
    plot3(0,"S3R3");
    plot4(0,"CP");
 end;
 If     DataCompression < 2       { intraday or tick bars }
    and (   (Date >= BeginDate and Date <= EndDate)
         or (LastCalcDateIntended and Date >= EndDate))then begin
       if Date = Date[ 1 ] then begin { all bars in day }
          For ii = 1  to kMax begin
             if LineID[ ii ] > 0 then
                TL_SetEnd( LineID[ ii ], Date, Time, SRValue[ ii ] ) ;
             if TextID[ ii ] > 0 then
                Text_SetLocation(TextID[ ii ], date, time+BarInterval+BarInterval,SRValue[ ii ]);
          end; { for }
       end { if Date = Date[ 1 ], i.e      all bars in day }
       else begin                   { first bar in day }
          pDH = HighD(1); pDL = LowD(1); pDC = CloseD(1); pDO = OpenD(1);
          pDRange = pDH - pDL; 
          SRValue[ kO0 ] = O;
          SRValue[ kC1 ] = pDC;
          if      PivotType = 1 then SRValue[ kCP ] = (pDH + pDL + O)/3        
          else if PivotType = 2 then SRValue[ kCP ] = (pDH + pDL + pDc)/3    
          else if PivotType = 3 then SRValue[ kCP ] = (pDH + pDL + pDC + O)/4  
          else if PivotType = 4 then SRValue[ kCP ] = (pDH + pDL + pDC + pDO)/4
          else                       SRValue[ kCP ] = (pDH + pDL + pDC)/3;
 
          SRValue[ kR1 ] = SRValue[ kCP ] + pDRange/2;
          SRValue[ kS1 ] = SRValue[ kCP ] - pDRange/2;
          SRValue[ kR2 ] = SRValue[ kCP ] + pDRange;       
          SRValue[ kS2 ] = SRValue[ kCP ] - pDRange;  
          SRValue[ kR3 ] = SRValue[ kR2 ] + pDRange;  
          SRValue[ kS3 ] = SRValue[ kS2 ] - pDRange;  
 
          SRValue[ kS2S3 ] = (SRValue[ kS2 ]+SRValue[ kS3 ])/2;
          SRValue[ kS1S2 ] = (SRValue[ kS1 ]+SRValue[ kS2 ])/2;
          SRValue[ kCPS1 ] = (SRValue[ kCP ]+SRValue[ kS1 ])/2;
          SRValue[ kCPR1 ] = (SRValue[ kCP ]+SRValue[ kR1 ])/2;
          SRValue[ kR1R2 ] = (SRValue[ kR1 ]+SRValue[ kR2 ])/2;
          SRValue[ kR2R3 ] = (SRValue[ kR2 ]+SRValue[ kR3 ])/2;
 
          For ii = 1 to kMax Begin
             { create lines }
             LineID[ ii ] = TL_New(Date,Time,SRValue[ ii ],Date,Time+BarInterval+BarInterval,SRValue[ ii ]);
             TL_SetExtLeft (LineID[ ii ],false);
             TL_SetExtRight(LineID[ ii ],false);
             if      ii <= kCP then
                Color = GetPlotColor(4)
             else if ii <= kS1 then
                Color = GetPlotColor(1)
             else if ii <= kS2 then
                Color = GetPlotColor(2)
             else if ii <= kS3 then
                Color = GetPlotColor(3)
             else 
                Color = StandardColor;
             TL_SetColor(LineID[ ii ],Color);
             
             { flip old text labels to other side of day boundry before creating new one }
             if TextID[ ii ] > 0 then begin
                Text_SetStyle (TextID[ ii ],1,0); { 1: HAlign=right, 0: VAlign=Top }
                Text_SetString(TextID[ ii ],TextLabel[ ii ]); 
             end;
 
             { create text labels }
             TextID[ ii ] = Text_New(Date,Time+BarInterval+BarInterval,SRValue[ ii ],NumToStr(mod(SRValue[ ii ],10000),1)+" "+TextLabel[ ii ]);
             Text_SetStyle(TextID[ ii ],0,2); { 0: HAlign=left, 2: VAlign=Centered }
 
             if      ii <= kCP then
                Color = GetPlotColor(4)
             else if ii <= kS1 then
                Color = GetPlotColor(1)
             else if ii <= kS2 then
                Color = GetPlotColor(2)
             else if ii <= kS3 then
                Color = GetPlotColor(3)
             else
                Color = StandardColor;
             Text_SetColor(TextID[ ii ],Color);
             { set line style of the "in-between" levels }
             If ii > kS3 then 
                TL_SetStyle(LineID[ ii ],Tool_dotted);
          end; { for }
       end; { else.. i.e.             first bar in day }
 end; { DataCompression < 2  }
 
		   | 
         
       
     | 
    
	
	 | 
  
  
   
     
       
      Zigarum
       Membro
	   
	   
	  Registrato dal: 
	  05/04/2006 
	   
	  
    Messaggi: 
    1996
     
     
      Offline 
 | 
     
      
         
          
            
              | Inviato il : 20/04/2006 - 20:27:22             | 
                
                      
                      
                      
                 | 
             
           
           
		   | 
         
         
          
		   quando lo plotti dove c e scritto tipo pivot col numero 1 usi c+h+l
 col 2 c+h+l +open giorno dopo
		   | 
         
       
     | 
    
	
	 | 
  
  
   
     
       
      Subtrader
       Membro
	   
	   
	  Registrato dal: 
	  18/04/2006 
	   
	  
    Messaggi: 
    6
     
     
      Offline 
 | 
     
      
         
          
            
              | Inviato il : 21/04/2006 - 13:07:21             | 
                
                      
                      
                      
                 | 
             
           
           
		   | 
         
         
          
		   Grazie Zigarum
 però ancora mi da errore... son proprio negato...
 allora ricapitolando... io ho fatto il copia e in colla di tutto quanto il testo da te pubblicato su "INDICATOR" , e su " FUNCTION " cosa devo scrivere ? 
 Grazie    
		   | 
         
       
     | 
    
	
	 | 
  
  
   
     
       
      Subtrader
       Membro
	   
	   
	  Registrato dal: 
	  18/04/2006 
	   
	  
    Messaggi: 
    6
     
     
      Offline 
 | 
     
      
         
          
            
              | Inviato il : 21/04/2006 - 13:33:47             | 
                
                      
                      
                      
                 | 
             
           
           
		   | 
         
         
          
		   i pivot/supp/res. che intendo sono quelli intraday ... calcolati cioè su MAX / MIN / CLOSE del giorno precedente    
		   | 
         
       
     | 
    
	
	 | 
  
  
   
     
       
      Zigarum
       Membro
	   
	   
	  Registrato dal: 
	  05/04/2006 
	   
	  
    Messaggi: 
    1996
     
     
      Offline 
 | 
     
      
     | 
    
	
	 | 
  
  
   
     
       
      Zigarum
       Membro
	   
	   
	  Registrato dal: 
	  05/04/2006 
	   
	  
    Messaggi: 
    1996
     
     
      Offline 
 | 
     
      
     | 
    
	
	 | 
  
  
   
     
       
      Subtrader
       Membro
	   
	   
	  Registrato dal: 
	  18/04/2006 
	   
	  
    Messaggi: 
    6
     
     
      Offline 
 | 
     
      
         
          
            
              | Inviato il : 24/04/2006 - 17:02:27             | 
                
                      
                      
                      
                 | 
             
           
           
		   | 
         
         
          
		   Tutto risolto    
 grazie mille    
		   | 
         
       
     | 
    
	
	 | 
  
  
   
     
       
      cyclical
       Membro
	   
	   
	  Registrato dal: 
	  12/04/2006 
	   
	  
    Messaggi: 
    6
     
     
      Offline 
 | 
     
      
         
          
            
              | Inviato il : 24/04/2006 - 19:22:50             | 
                
                      
                      
                      
                 | 
             
           
           
		   | 
         
         
          
		   contribuisco con la formula che uso io, praticamente calcola i pivots sul timeframe superiore e li plotta su quello inferiore, ad es. ti plotta i pivots daily sull'intraday oppure i weekly sul daily e ancora i monthly su quello settimanale e gli annuali sul mensile:
 
 Vars:Hi1(0),Lo1(0),Cl1(0);
 Vars: Pivot(0), Res1(0), Res2(0),Res3(0), Sup1(0), Sup2(0),Sup3(0),x(0);
 Arrays:TLId[5](-1),TLVal[5](0);
 If DataCompression= 1 then begin   {Dati intraday ->>>>  S/R daily}
    Hi1=HighD(1);
    Lo1=LowD(1);
    Cl1=CloseD(1);
    Condition1=d<>d[1];
 end;
 If DataCompression=2 then begin      {Dati daily ->>>>> S/R weekly}
    Hi1=HighW(1);
    Lo1=LowW(1);
    Cl1=CloseW(1);
    Condition1=dayofweek(d)<dayofweek(d[1]);
 end;
 If DataCompression=3 then begin      {Dati weekly ->>>>>> S/R MOnthly}
    Hi1=HighM(1);
    Lo1=LowM(1);
    Cl1=CloseM(1);
    Condition1=Month(d)<>Month(d[1]);
 end;
 If DataCompression=4 then begin      {Dati monthly ->>>>>> S/R Yearly}
    Hi1=HighY(1);
    Lo1=LowY(1);
    Cl1=CloseY(1);
    Condition1=Year(d)<>Year(d[1]);
 end;
 
 Pivot = (Hi1+Lo1+Cl1)/3;
 Res1=2*Pivot-Lo1;       TLVal[0]=Res1;
 Sup1=2*Pivot-Hi1;       TLVal[3]=Sup1;
 Res2=Pivot-Sup1+Res1;   TLVal[1]=Res2;
 Sup2=Pivot-Res1+Sup1;   TLVal[4]=Sup2;
 Res3=Pivot-Sup2+Res2;   TLVal[2]=Res3;
 Sup3=Pivot-Res2+Sup2;   TLVal[5]=Sup3;
 If Condition1=True then begin            {Inizio nuovo periodo}
    If TLId[0]=-1 then begin                     {Prima creazione delle TLs}
       TLId[0]=TL_New(d[1], t[1], TLVal[0], d, t, TLVal[0]);
       TLId[1]=TL_New(d[1], t[1], TLVal[1], d, t, TLVal[1]);
       TLId[2]=TL_New(d[1], t[1], TLVal[2], d, t, TLVal[2]);
       TLId[3]=TL_New(d[1], t[1], TLVal[3], d, t, TLVal[3]);
       TLId[4]=TL_New(d[1], t[1], TLVal[4], d, t, TLVal[4]);
       TLId[5]=TL_New(d[1], t[1], TLVal[5], d, t, TLVal[5]);
       For x=0 to 5 begin                        {Setta estensione}
          TL_SetExtLeft(TLId[x], True);
          TL_SetExtRight(TLId[x], True);
          TL_SetStyle(TLId[x], Tool_Dashed);         {Setta stile}
       end;
       For x=0 to 2 begin                        {Setta Colori}
          TL_SetColor(TLId[x], Tool_Red);
       end;
       For x=3 to 5 begin
          TL_SetColor(TLId[x], Tool_Green);
       end;
    end else begin
       For x=0 to 5 begin
          TL_SetEnd(TLId[x], d, t, TLVal[x]);
          TL_SetBegin(TLId[x], d[1], t[1], TLVal[x]);
        end;
    end;
 end;    
 If LastBarOnChart then begin
     Vars:Str("");
     Str=Str+" Res3 : "+NumToStr(Res3,2)+NewLine;
     Str=Str+" Res2 : "+NumToStr(Res2,2)+NewLine;
     Str=Str+" Res1 : "+NumToStr(Res1,2)+NewLine;
     Str=Str+" Pivot : "+NumToStr(Pivot,2)+NewLine;
     Str=Str+" Sup1 : "+NumToStr(Sup1,2)+NewLine;
     Str=Str+" Sup2 : "+NumToStr(Sup2,2)+NewLine;
     Str=Str+" Sup3 : "+NumToStr(Sup3,2)+NewLine;
     Commentary(Str);
 end; 
		   | 
         
       
     | 
    
	
	 |