// Using ZIGZAG // Identify downside/upside Lag then buy or sell // velappan periasamy // 03/Mar/2007 {$I 'ZigZag Study'} var Bar, Lag,Lagdown,Lagup,pane,x,y: integer; ZigZag( 5 ); PlotSeries( PeakSeries( #Close, 5 ), 0, #Red, #Dots ); PlotSeries( TroughSeries( #Close, 5 ), 0, #Blue, #Dots ); Lagdown := CreateSeries; Lagup := CreateSeries; SetShareSize(10); var RSIPane: integer; RSIPane := CreatePane( 80, true, true ); for Bar := 100 to BarCount - 1 do begin if Peak( Bar, #Close, 5 ) <> Peak( Bar - 1, #Close, 5 ) then begin Lag := Bar - PeakBar( Bar, #Close, 5 ); x:=Bar-Lag+1; SetSeriesValue( x, Lagup, Lag); AnnotateBar( 'Lag = ' + IntToStr( Lag ), PeakBar( Bar, #Close, 5 ), true, #Red, 8 ) end; if Trough( Bar, #Close, 5 ) <> Trough( Bar - 1, #Close, 5 ) then begin Lag := Bar - TroughBar( Bar, #Close, 5 ); y:=Bar-Lag+1; SetSeriesValue(y , Lagdown, -Lag); AnnotateBar( 'Lag = ' + IntToStr( Lag ), TroughBar( Bar, #Close, 5 ), false, #Blue, 8 ); end; end; DrawText( ' UP/DOWN indi***or *** Green Buy Red Sell ***', RSIPane, 0, 1, #black, 15); PlotSeries(Lagdown,RSIPane, #green, #Thick ); PlotSeries(Lagup,RSIPane, #red, #Thick ); for Bar := 100 to BarCount - 1 do begin SetPaneBackgroundColor( Bar, 0, #Greenbkg); end ; for Bar := 100 to BarCount - 1 do begin if GetSeriesValue( Bar, Lagdown ) < 0 then BuyAtMarket(Bar+1, ''); if GetSeriesValue( Bar, Lagup ) > 0 then SellAtMarket(Bar+1,#all,''); if GetSeriesValue( Bar, Lagdown ) < 0 then SetPaneBackgroundColor( Bar, 0, #Green ) else if GetSeriesValue( Bar, Lagup ) > 0 then SetPaneBackgroundColor( Bar, 0, #Red ); SetBackgroundColor( Bar, #bluebkg ); end;
// Using ZIGZAG // Identify downside/upside Lag then buy or sell // velappan periasamy // 03/Mar/2007 {$I 'ZigZag Study'} var Bar, Lag,Lagdown,Lagup,pane,x,y: integer; ZigZag( 5 ); PlotSeries( PeakSeries( #Close, 5 ), 0, #Red, #Dots ); PlotSeries( TroughSeries( #Close, 5 ), 0, #Blue, #Dots ); Lagdown := CreateSeries; Lagup := CreateSeries; SetShareSize(10); var RSIPane: integer; RSIPane := CreatePane( 80, true, true ); for Bar := 100 to BarCount - 1 do begin if Peak( Bar, #Close, 5 ) <> Peak( Bar - 1, #Close, 5 ) then begin Lag := Bar - PeakBar( Bar, #Close, 5 ); x:=Bar-Lag+1; SetSeriesValue( x, Lagup, Lag); AnnotateBar( 'Lag = ' + IntToStr( Lag ), PeakBar( Bar, #Close, 5 ), true, #Red, 8 ) end; if Trough( Bar, #Close, 5 ) <> Trough( Bar - 1, #Close, 5 ) then begin Lag := Bar - TroughBar( Bar, #Close, 5 ); y:=Bar-Lag+1; SetSeriesValue(y , Lagdown, -Lag); AnnotateBar( 'Lag = ' + IntToStr( Lag ), TroughBar( Bar, #Close, 5 ), false, #Blue, 8 ); end; end; DrawText( ' UP/DOWN indi***or *** Green Buy Red Sell ***', RSIPane, 0, 1, #black, 15); PlotSeries(Lagdown,RSIPane, #green, #Thick ); PlotSeries(Lagup,RSIPane, #red, #Thick ); for Bar := 100 to BarCount - 1 do begin SetPaneBackgroundColor( Bar, 0, #Greenbkg); end ; for Bar := 100 to BarCount - 1 do begin if GetSeriesValue( Bar, Lagdown ) < 0 then BuyAtMarket(Bar+1, ''); if GetSeriesValue( Bar, Lagup ) > 0 then SellAtMarket(Bar+1,#all,''); if GetSeriesValue( Bar, Lagdown ) < 0 then SetPaneBackgroundColor( Bar, 0, #Green ) else if GetSeriesValue( Bar, Lagup ) > 0 then SetPaneBackgroundColor( Bar, 0, #Red ); SetBackgroundColor( Bar, #bluebkg ); end;
الكلمات الدلالية (Tags) |
مؤشر, المختصر, ابو, سلطاان |
أدوات الموضوع | |
تعليمات المشاركة |
لا تستطيع إضافة مواضيع جديدة
لا تستطيع الرد على المواضيع
لا تستطيع إرفاق ملفات
لا تستطيع تعديل مشاركاتك
BB code is متاحة
الابتسامات متاحة
كود [IMG] متاحة
كود HTML معطلة
|