![]() |
ماشاء الله تبارك الله ماشاء الله لاقوة الا بالله , اللهم اني اسالك الهدى
والتقى والعفاف والغنى
| |
|
|
|
|
|
|
|||||||
|
|
|
|
|
#15 | |
|
وهذي معادلة مدمجة اخرى ![]() كود:
var BAR,chartpane: integer;
for Bar := 20 to BarCount - 1 do
begin
if PriceClose(bar) > 5000 then setpositionsize(priceclose(bar)*1.1);
if LastPositionActive then
begin
if PositionLong( LastPosition ) then
{ Long Position Exit Rules }
begin
if (Aroondown(bar,#close,7) > 99) then
SellAtMarket( Bar+1, LastPosition, '' );
end
else
end;
end;
chartPane := CreatePane( 75, true, true );
PlotSeries( AroonUpSeries( #Close,14 ), chartpane, 009, #Thin );
PlotSeries( AroonDownSeries( #Close,14 ), chartpane, 905, #Thin );
var lrBar1, lrBar2: integer;
var lrPrice1, lrPrice2: float;
var sd: float;
lrBar1 := BarCount - 66;
lrBar2 := BarCount - 1;
lrPrice2 := LinearReg (BarCount - 1, #close, 65);
lrPrice1 := lrPrice2 - (65 * LinearRegSlope (BarCount - 1, #close, 65));
sd := stddev (BarCount - 1, #close, 65);
DrawLine (lrBar1,lrPrice1,lrBar2,lrPrice2,0, #Red, #solid);
DrawLine (lrBar1,lrPrice1+(1.5*sd),lrBar2,lrPrice2+(1.5*sd),0, #Blue, #solid);
DrawLine (lrBar1,lrPrice1-(1.5*sd),lrBar2,lrPrice2-(1.5*sd),0, #Blue, #solid);
DrawLine (lrBar1,lrPrice1+(3*sd),lrBar2,lrPrice2+(3*sd),0, #Green, #solid);
DrawLine (lrBar1,lrPrice1-(3*sd),lrBar2,lrPrice2-(3*sd),0, #Green, #solid);
print (floattostr (lrPrice2+(3*sd)));
print (floattostr (lrPrice2+(1.5*sd)));
print (floattostr (lrPrice2));
print (floattostr (lrPrice2-(1.5*sd)));
print (floattostr (lrPrice2-(3*sd)));
AnnotateChart ('LR', 0, BarCount - 66, lrPrice1, #blue, 12);
AnnotateChart ('1.5SD', 0, BarCount - 66, lrPrice1+(1.5*sd), #blue, 12);
AnnotateChart ('1.5SD', 0, BarCount - 66, lrPrice1-(1.5*sd), #blue, 12);
AnnotateChart ('3SD', 0, BarCount - 66, lrPrice1+(3*sd), #blue, 12);
AnnotateChart ('3SD', 0, BarCount - 66, lrPrice1-(3*sd), #blue, 12);
var K: integer;
var D: integer;
var xStochS: float;
K := StochDSeries( 5, 3 );
D := SMASeries( K, 3 );
var Pane1: integer; Pane1 := CreatePane( 80,true,false );
PlotSeries( K, Pane1, #Purple, #Thin );
PlotSeries( D, Pane1, 555, #Thin );
xStochS := GetSeriesValue( BarCount - 1, K );
DrawText( 'Slow StochK(5) ' + FormatFloat( '#,##0.00', xStochS ), Pane1, 4, 4, #Purple, 8 );
xStochS := GetSeriesValue( BarCount - 1, D );
DrawText( 'Slow StochD(5, 3) ' + FormatFloat( '#,##0.00', xStochS ), Pane1, 4, 14, 444, 8 );
DrawHorzLine( 20, Pane1, 777, #Dotted );
DrawHorzLine( 80, Pane1, 777, #Dotted );
DrawHorzLine( 50, Pane1, 333, #Thin );
var xRSI: float;
var Pane2: integer; Pane2 := CreatePane( 80,true,false );
SetPaneMinMax( Pane2, 20, 80 );
DrawHorzLine( 50, Pane2, 333, #Solid );
DrawHorzLine( 30, Pane2, 777, #Dotted );
DrawHorzLine( 70, Pane2, 777, #Dotted );
PlotSeries( RSISeries( #Close, 14 ), Pane2, #Navy, #Thick );
xRSI := RSI( BarCount - 1, #Close, 14 );
DrawText( 'RSI(14) ' + FormatFloat( '#,##0.00', xRSI ), Pane2, 4, 4, #Navy, 8 );
{$I 'MACDEx'}
var MPane, MEx, MHist: integer;
MEx := MACDExSeries( #Close, 12, 26 );
MHist := SubtractSeries( MEx, EMASeries( MEx, 9 ) );
MPane := CreatePane( 100, true, true );
PlotSeries( MEx, MPane, #red, #Thick );
PlotSeries( EMASeries( MEx, 9 ), MPane,009, #dotted );
PlotSeries( MHist, MPane, 777, #Histogram );
DrawLabel( 'MACDEx(12,26) and 9 period Signal Line', MPane );
Bar := BarCount - 1;
if CrossOver( Bar, MEx, EMASeries( MEx, 9 ) ) then
begin
BuyAtMarket( Bar + 1, '' );
end;
HideVolume
|
|
|
|
|
|
|
#16 | |
|
هذا المؤشر حلوو على الويكلي ويعطي اشارات حلوة كود:
const BREAKOUT = 0.01;
const MAXTRADESPERWEEK = 2;
var Bar, p, TradesThisWeek: integer;
var H, L: float;
{ This function provides the text for the ExitSignalName }
function ExitSignal( Bar: integer ): string;
begin
Result := 'Next Trading Day';
if Bar < BarCount - 1 then
case DayOfWeek( Bar ) of
#Monday: Result := 'Monday';
#Tuesday: Result := 'Tuesday';
#Wednesday: Result := 'Wednesday';
#Thursday: Result := 'Thursday';
#Friday: Result := 'Friday';
end;
end;
{ Due to holidays, the market might be closed on Friday. }
function LastWeekDay( Bar: integer ): boolean;
begin
if Bar < BarCount - 1 then
Result := DayOfWeek( Bar ) > DayOfWeek( Bar + 1 )
else
Result := DayOfWeek( Bar ) = #Friday;
end;
function TomorrowIsLastWeekDay( Bar: integer ): boolean;
begin
if Bar < BarCount - 2 then
Result := DayOfWeek( Bar + 1 ) > DayOfWeek( Bar + 2 )
else
Result := DayOfWeek( Bar ) = #Thursday;
end;
{ Code execution starts here }
PlotStops;
HideVolume;
for Bar := 1 to BarCount - 1 do
begin
if LastWeekDay( Bar ) then // No action required on Friday
continue;
if DayOfWeek( Bar ) < DayOfWeek( Bar - 1 ) then // Monday or start of week
begin
TradesThisWeek := 0;
SetBackgroundColor( Bar, #BlueBkg );
H := PriceHigh( Bar );
L := PriceLow( Bar );
end;
if TomorrowIsLastWeekDay( Bar ) then
begin
if LastPositionActive then
begin
p := LastPosition;
if PositionLong( p ) then
SellAtMarket( Bar + 1, p, 'EndofWeek' )
else
CoverAtMarket( Bar + 1, p, 'EndofWeek' );
end;
end
else
begin
case MarketPosition of
0: { No position }
if BuyAtStop( Bar + 1, H + BREAKOUT, '' ) then
Inc( TradesThisWeek )
else if ShortAtStop( Bar + 1, L - BREAKOUT, '' ) then
Inc( TradesThisWeek );
1: { Long }
if SellAtStop( Bar + 1, L - BREAKOUT, LastPosition, ExitSignal( Bar + 1 ) ) then
if TradesThisWeek < MAXTRADESPERWEEK then
if ShortAtStop( Bar + 1, L - BREAKOUT, '' ) then
Inc( TradesThisWeek );
-1: { Short }
if CoverAtStop( Bar + 1, H + BREAKOUT, LastPosition, ExitSignal( Bar + 1 ) ) then
if TradesThisWeek < MAXTRADESPERWEEK then
if BuyAtStop( Bar + 1, H + BREAKOUT, '' ) then
Inc( TradesThisWeek );
end;
end;
end;
|
|
|
|
|
|
|
#17 | |
|
وهذا يرسم لنا القنوات كود:
var STARTPOINT, ENDPOINT, DIFF, MAXDIFF: float; var STARTBAR, ENDBAR, BAR: integer; StartBar := BarCount - 100; EndBar := BarCount - 1; StartPoint := LinearRegLine( #Close, StartBar, EndBar, StartBar ); EndPoint := LinearRegLine( #Close, StartBar, EndBar, EndBar ); DrawLine( StartBar, StartPoint, EndBar, EndPoint, 0, #YELLOW, #Thick ); MaxDiff := 0; for Bar := StartBar to EndBar do begin Diff := Abs( PriceClose( Bar ) - LinearRegLine( #Close, StartBar, EndBar, Bar ) ); if Diff > MaxDiff then MaxDiff := Diff; end; DrawLine( StartBar, StartPoint + MaxDiff, EndBar, EndPoint + MaxDiff, 0, #YELLOW, #Dotted ); DrawLine( StartBar, StartPoint - MaxDiff, EndBar, EndPoint - MaxDiff, 0, #YELLOW, #Dotted ); |
|
|
|
|
|
|
#18 | |
|
![]() المعادلة كود:
|
|
|
|
|
|
|
#19 | |
|
HILOLIMIT OPTIMIZED FOR ETFS ![]() // Basic HiLoLimit Trader (friendly) // by DrKoch 2004-03-15 // include three modules from Code Library (www) // or Indicator directory (WLD) {$I 'BandTrader'} {$I 'HiLoLimit'} {$I 'WinLossBackground'} //// Variables var lookback_period, hilo_level, timeout: integer; var minrange, profit_target: float; var hilo_s, hs, ls, i: integer; // Series var sym, params : string; //list used to hold pre-optimized params for different ETFs var lst: TList; lst := TList.Create; lst.AddData('DIA','4,19,7,16'); lst.AddData('DSV','4,12,8,17'); lst.AddData('ELG','4,13,8,16'); lst.AddData('ELV','4,14,11,20'); lst.AddData('EWA','4,18,12,20'); lst.AddData('EWC','4,19,8,16'); lst.AddData('EWD','4,13,9,20'); lst.AddData('EWG','4,12,11,20'); lst.AddData('EWH','4,13,7,14'); lst.AddData('EWI','4,18,12,20'); lst.AddData('EWK','4,12,12,18'); lst.AddData('EWL','4,12,10,14'); lst.AddData('EWO','4,12,10,20'); lst.AddData('EWP','4,21,10,18'); lst.AddData('EWQ','4,12,12,19'); lst.AddData('EWS','4,12,7,18'); lst.AddData('EWU','4,16,12,20'); lst.AddData('EWW','4,12,8,17'); lst.AddData('EWY','4,15,7,20'); lst.AddData('EZA','4,12,12,15'); lst.AddData('EZU','4,17,10,20'); lst.AddData('FFF','4,12,12,19'); lst.AddData('IGE','4,13,12,20'); lst.AddData('IGN','4,14,7,17'); lst.AddData('IGV','4,12,11,20'); lst.AddData('IJH','4,13,11,19'); lst.AddData('IJR','4,18,11,20'); lst.AddData('ILF','4,14,12,20'); lst.AddData('IOO','4,13,11,16'); lst.AddData('IVE','4,12,9,20'); lst.AddData('IVV','4,13,11,18'); lst.AddData('IVW','4,12,7,20'); lst.AddData('IWB','4,12,11,17'); lst.AddData('IWD','4,13,11,20'); lst.AddData('IWF','4,12,9,20'); lst.AddData('IWN','4,12,11,20'); lst.AddData('IWP','4,23,11,20'); lst.AddData('IWV','4,13,11,18'); lst.AddData('IWW','4,13,11,19'); lst.AddData('IXC','4,12,12,20'); lst.AddData('IXP','4,12,11,20'); lst.AddData('IYE','4,13,7,20'); lst.AddData('IYF','4,12,11,19'); lst.AddData('IYJ','4,14,11,20'); lst.AddData('IYM','4,12,12,19'); lst.AddData('IYR','4,20,10,18'); lst.AddData('ONEQ','4,13,9,18'); lst.AddData('RKH','4,13,10,20'); lst.AddData('RSP','4,22,8,20'); lst.AddData('SMH','4,22,7,17'); lst.AddData('SPY','4,13,12,20'); lst.AddData('TTE','4,19,11,18'); lst.AddData('TTH','4,12,12,20'); lst.AddData('UTH','4,19,12,18'); lst.AddData('VTI','4,13,11,20'); lst.AddData('XLB','4,12,12,19'); lst.AddData('XLE','4,12,8,20'); lst.AddData('XLF','4,12,11,19'); lst.AddData('XLI','4,13,9,20'); lst.AddData('BBH','5,15,6,19'); lst.AddData('BDH','5,12,6,20'); lst.AddData('EFA','5,19,11,17'); lst.AddData('EPP','5,16,12,14'); lst.AddData('EWM','5,16,6,15'); lst.AddData('EWN','5,13,11,17'); lst.AddData('FEU','5,12,12,20'); lst.AddData('FEZ','5,15,11,17'); lst.AddData('IEV','5,12,8,20'); lst.AddData('IJJ','5,12,9,20'); lst.AddData('IJK','5,14,12,20'); lst.AddData('IJS','5,18,8,20'); lst.AddData('IJT','5,17,8,19'); lst.AddData('IWR','5,12,9,20'); lst.AddData('IXJ','5,15,11,14'); lst.AddData('IYG','5,12,8,18'); lst.AddData('IYH','5,14,7,17'); lst.AddData('MDY','5,14,12,20'); lst.AddData('VXF','5,15,8,20'); lst.AddData('WMH','5,12,7,20'); lst.AddData('EWT','6,14,6,20'); lst.AddData('IDU','6,12,12,17'); lst.AddData('IWO','6,17,8,16'); lst.AddData('IWM','7,12,8,20'); lst.AddData('MTK','7,15,7,18'); lst.AddData('RTH','7,12,12,18'); lst.AddData('DSG','8,12,7,15'); lst.AddData('HHH','8,23,12,15'); lst.AddData('QQQQ','4,15,11,20'); //// Parameters // unused here, useful for Intraday Data or low volume data minrange := 0.0; sym := GetSymbol(); i := lst.IndexOf(sym); if i >= 0 then begin params := lst.Data(i); lookback_period := StrToInt(GetToken(params, 0, ',')); // calculate limit this level *below* Lowest hilo_level := -1 * StrToInt(GetToken(params, 1, ',')); // unused here, useful for Intraday Data or low volume data minrange := 0.0; // Profit Target in percent profit_target := StrToInt(GetToken(params, 3, ',')) / 10.0; //1.7; // Timeout in Bars timeout := StrToInt(GetToken(params, 2, ',')); end else begin //we don't have params so use the defaults lookback_period := 4; // calculate limit this level *below* Lowest hilo_level := -19; // unused here, useful for Intraday Data or low volume data minrange := 0.0; // Profit Target in percent profit_target := 12 / 10.0; // Timeout in Bars timeout := 12; end; // Calculate Highest and Lowest (for Graphics only) hs := HighestSeries( #High, lookback_period ); ls := LowestSeries( #low, lookback_period ); // Calculate HiLo level series (uses Highest/Lowest internally) hilo_s := HiLoLimitSeries(lookback_period, hilo_level, minrange); //// Graphics HideVolume(); PlotSeries(EMASeries(#Volume, 30), 1, #Red, #Thin); // Plot Highest and Lowest PlotSeriesLabel(hs, 0, #Green, #Thin, 'Highest(' + IntToStr(lookback_period) + ')'); PlotSeriesLabel(ls, 0, #Blue, #Thin, 'Lowest(' + IntToStr(lookback_period) + ')'); // Plot Limit in red PlotSeriesLabel(hilo_s, 0, 955, #Thin,'Limit := Lowest - (Hi - Lo) * ' + FloatToStr(hilo_level/100)); // Plot Limit used in Bandtrader (Limit price from yesterday) PlotSeriesLabel(OffsetSeries( hilo_s, -1), 0, #Red, #Thick, 'Limit Price'); DrawText('Lookback Period: ' + FloatToStr(lookback_period), 1, 4, 4, #Black, 8 ); DrawText( 'Hi/Lo Level ' + FloatToStr(hilo_level), 1, 4, 15, #Black, 8 ); DrawText( 'Timeout (days):' +FloatToStr(timeout), 1, 4, 26, #Black, 8 ); DrawText( 'Profit Target:' + FloatToStr(profit_target), 1, 4, 37, #Black, 8 ); //// Band Violation Trading System // contains BuyAtLimit() commands //BandTrader(hilo_s, profit_target, timeout); var Bar: integer; InstallTimeBasedExit(timeout); InstallProfitTarget ( profit_target ); for Bar := 0 to BarCount() - 1 do begin var limitPrice: float; var P: integer; // Positions ApplyAutoStops( Bar ); limitPrice := GetSeriesValue(Bar, hilo_s); if limitPrice = 0.0 then continue; BuyAtLimit(Bar + 1, limitPrice, 'HiLoLimit Buy'); end; //// Visualize Results // show profits as background color WinLossBackground(0); |
|
|
|
|
|
|
#20 | |
|
معادلة المؤشر الاول [/color][/size][/align] كود:
var DailyH, DailyL, DailyC: integer; SetScaleDaily; DailyH := IntraDayFromDaily( #High ); DailyL := IntraDayFromDaily( #Low ); DailyC := IntraDayFromDaily( #Close ); RestorePrimarySeries; PlotSeries( DailyH, 0, #Red, #Dotted); PlotSeries( DailyL, 0, #Green, #Dotted ); معادلة المؤشر الثاني كود:
var Bar, SMA20, SMA60, SMA20_10, SMA60_10: integer;
//Get 20 and 60 bar 1 minute SMAs
SMA20 := SMASeries( #Close, 20 );
SMA60 := SMASeries( #Close, 60 );
//Switch to 10 minute scale
SetScaleCompressed( 10 );
//Obtain 20 and 60 bar 10 minute SMAs
SMA20_10 := SMASeries( #Close, 20 );
SMA60_10 := SMASeries( #Close, 60 );
//Expand them to original time frame
SMA20_10 := IntradayFromCompressed( SMA20_10, 10 );
SMA60_10 := IntradayFromCompressed( SMA60_10, 10 );
//Switch back to the original time frame
RestorePrimarySeries;
//Plot the SMAs
PlotSeries( SMA20, 0, #Red, #Thin );
PlotSeries( SMA60, 0, #Green, #Thin );
PlotSeries( SMA20_10, 0, #Red, #Thick );
PlotSeries( SMA60_10, 0, #Green, #Thick );
//Highlight Crossovers
for Bar := 600 to BarCount - 1 do
begin
if CrossOver( Bar, SMA20, SMA60 ) then
AnnotateChart( '1 Minute Crossover', 0, Bar, @SMA20[Bar], #Red, 12 );
if CrossOver( Bar, SMA20_10, SMA60_10 ) then
AnnotateChart( '10 Minute Crossover', 0, Bar, @SMA20_10[Bar], #Green, 12 );
end;
![]() وهذا الثاني ![]() |
|
|
|
|
|
|
#21 | |
|
![]() كود:
{ An SMA Crossover system }
var BAR, hSlow, hFast, SlowPer, FastPer: integer;
SlowPer := 60;
FastPer := 20;
hSlow := SMASeries( #Close, SlowPer );
hFast := SMASeries( #Close, FastPer );
PlotSeries( hSlow, 0, 770, #Thick );
PlotSeries( hFast, 0, 999, #Thick );
PlotSeries( EMASeries( #Close,14 ), 0, #Fuchsia, #dotted );
for Bar := SlowPer to BarCount - 1 do
begin
if not LastPositionActive then
begin
if CrossOver( Bar, hFast, hSlow ) then
BuyAtMarket( Bar + 1, '');
end
else
begin
if CrossUnder( Bar, hFast, hSlow ) then
SellAtMarket( Bar + 1, LastPosition, '' );
end;
end;
SetColorScheme( #green, 900, #Olive, #Black, #white, #Silver );
|
|
|
|
|
![]() |
| مواقع النشر (المفضلة) |
| الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1) | |
| أدوات الموضوع | |
| انواع عرض الموضوع | |
|
|
المواضيع المتشابهه
|
||||
| الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
| متوسطات لبرنامج الويلث . | مزارع | التحليل الفني والأساسي | 4 | 04-06-2010 01:02 AM |
| عقوبة النحلة السكرانة | عذبة السجايا | استراحة اعمال السعوديه | 0 | 03-02-2010 08:38 PM |
| الرائد يهزم النجمة ويتصدرالمجموعة | habob | استراحة اعمال السعوديه | 0 | 12-21-2009 06:35 PM |
| السلاااااااام عليكم بعد غياب أرجع لكم ياأحبتي////العملاق7777///////////////////////// | العملاق7777 | منتدى الاسهم السعوديه | 34 | 04-20-2009 02:27 PM |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27