Jump to content

Req: Multicharts Trading system


Recommended Posts

 

{for: Strategy Oddball }

 

 

Function: RateOfChange

 

 

inputs: Price( numericseries ), Length( numericsimple ) ;

 

if Price[Length] <> 0 then

RateOfChange = ( Price / Price[Length] - 1 ) * 100

else

RateOfChange = 0 ;

 

...........................

 

Strategy: Oddball

 

 

Inputs: RL(7), BZ(2), RL2(7), SZ(2);

 

 

If RateOFChange(Close,RL)>BZ Then Buy this bar at close ;

 

If RateOFChange(Close,RL2)<SZ Then Sellshort this bar at close;

 

----------------------------------------------------------------

 

Strategy: Ares

 

 

Input:n1(5),n2(20);

 

 

if c>c[n1] and c<c[n2] then buy next bar at market;

 

if c<c[n1] and c>c[n2] then sellshort next bar at market;

 

 

------------------------------------------------------------------------------

 

Strategy: Urval

 

input: ptarget (13), stopl (9);

variables: profitprice (0), stopprice (0);

 

if h[1] > o[1] AND o[1] > h[0] AND h[0] > o[0] AND o[0] >

c[1] AND c[1] > l[1] AND l[1] > c[0] AND c[0] > l[0] then

begin

buy next bar at open;

if Marketposition = 0 then begin

profitprice = O of tomorrow * (1+ptarget/100);

stopprice = O of tomorrow * (1-stopl/100);

sellshort next bar at profitprice limit;

sellshort next bar at stopprice stop;

end;

end;

if Marketposition= 1 then begin

profitprice= entryprice * (1 + ptarget/100);

stopprice= entryprice * (1 - stopl/100);

sellshort next bar at profitprice limit;

sellshort next bar at stopprice stop;

end;

 

------------------------------------------------------------------------------

 

Strategy: RSI LE and SE

 

 

inputs: Price( Close ), Length( 9 ), OverSold( 35 ), OverBought( 55 ) ;

variables: MyRSI( 0 ) ;

 

MyRSI = RSI( Price, Length ) ;

 

if Currentbar > 1 and MyRSI crosses over OverSold then Buy ( "RsiLE" ) next bar at market ;

 

if Currentbar > 1 and MyRSI crosses under OverBought then SellShort ( "RsiSE" ) next bar at market ;

 

..................................

 

The Function: RSI should already be in Multicharts, otherwise you can use this:

 

 

Function: RSI

 

{ Relative Strength Index; note that the algorithm used here is a simpler and more

efficient mathematical equivalent of the original Wilder algorithm }

 

inputs:

Price( numericseries ),

Length( numericsimple ) ; { this input assumed to be a constant >= 1 }

 

variables:

NetChgAvg( 0 ),

TotChgAvg( 0 ),

Change( 0 ),

SF( 1 / Length ), { smoothing factor }

ChgRatio( 0 ) ;

 

if CurrentBar = 1 then

begin

NetChgAvg = ( Price - Price[Length] ) / Length ;

TotChgAvg = Average( AbsValue( Price - Price[1] ), Length ) ;

end

else

begin

Change = Price - Price[1] ;

NetChgAvg = NetChgAvg[1] + SF * ( Change - NetChgAvg[1] ) ;

TotChgAvg = TotChgAvg[1] + SF * ( AbsValue( Change ) - TotChgAvg[1] ) ;

end ;

 

if TotChgAvg <> 0 then

ChgRatio = NetChgAvg / TotChgAvg

else

ChgRatio = 0 ;

 

RSI = 50 * ( ChgRatio + 1 ) ;

 

-------------------------------------------------------------------------------------------------------

 

 

Link to comment
Share on other sites

  • 4 weeks later...
  • 1 year later...

If there is no Function: BollingerBand in Multicharts, I will add it in the code

------------------------------------------------------------------------------------------------

Inputs: bollingerLengths(50),liqLength(50),rocCalcLength(30);
Vars: upBand(0),dnBand(0),liqDays(50),rocCalc(0);

upBand = BollingerBand(Close,bollingerLengths,1.25);
dnBand = BollingerBand(Close,bollingerLengths,-1.25);
rocCalc = Close - Close[rocCalcLength-1]; {remember to subtract 1}
if(MarketPosition <> 1 and rocCalc > 0) then Buy("BanditBuy")tomorrow upBand
stop;
if(MarketPosition <>-1 and rocCalc < 0) then SellShort("BanditSell") tomorrow
dnBand stop;
if(MarketPosition = 0) then liqDays = liqLength;
if(MarketPosition <> 0) then
begin
liqDays = liqDays - 1;
liqDays = MaxList(liqDays,10);
end;

if(MarketPosition = 1 and barssinceentry>=6 and Average(Close,liqDays) < upBand) then
Sell("Long Liq") tomorrow Average(Close,liqDays) stop;

if(MarketPosition = -1 and barssinceentry>=6 and Average(Close,liqDays) > dnBand) then
BuyToCover("Short Liq") tomorrow Average(Close,liqDays) stop;

Link to comment
Share on other sites

Inputs: n1(12), n2(25), n3(12), n4(25);

If ADX(n1) > n2 and DMIPlus(14) > DMIMinus(14) and ((L<L[1] and L[1]<L[2] and L[2]<L[3]) {three lower lows} or (L[1]<L[2] and L[2]<L[3] and (H<H[1] and L>L[1])) {or two lower lows and an inside day} or ((L[2]>L[3] and H[2]<H[3]) and L<L[1] and L[1]<L[2])) {or an inside day and two lower lows} then buy this bar;

If ADX(n3) > n4 and DMIPlus(14) < DMIMinus(14) and ((H>H[1] and H[1]>H[2] and H[2]>H[3]) {three higher highs} or (H[1]>H[2] and H[2]>H[3] and (H<H[1] and L>L[1])) {or two higher highs and an inside day} or ((L[2]>L[3] and H[2]<H[3]) and H>H[1] and H[1]>H[2])) {or an inside day and two higher highs} then sellshort this bar;

 

Link to comment
Share on other sites

Inputs:AtrMult(3),AtrLen(21);
Vars:HClose(-99999),LClose(99999);

Value1=AtrMult*WAverage(TrueRange, AtrLen);
HClose=IFF(C>HClose,C,HClose);                            
LClose=IFF(C<LClose,C,LClose);                            

If CurrentBar=1 then Value2=HClose-Value1;
If C < Value2 then begin
    Value2=LClose+Value1;
    HClose=C;
End;
If C > Value2 then begin
    Value2=HClose-Value1;
    LClose=C;
End;
If Close crosses above Value2 then Buy this bar at close;
If Close crosses below Value2 then Sellshort this bar at close;

 

Link to comment
Share on other sites

 inputs: Per(3),Perc(0.05);
    vars: LevelLong(0),LevelShort(0);
    vars: BandWidth(0),Percentuale(0);

    LevelLong = HighestFC(H,Per);
    LevelShort = LowestFC(L,Per);
    BandWidth = BollingerBand(C,20,2)-BollingerBand(C,20,-2);
    Percentuale = Perc*C[1];

    if BandWidth<Percentuale then begin
       buy next bar LevelLong stop;
       sellshort next bar LevelShort stop;
    end;

 

Link to comment
Share on other sites

Inputs: RSI_Period(2), RSI_Overbought(10), RSI_OverSold(10), MA_Exit_Period(5), stop_loss(2000);

Variables: RSI_Value(0), Exit_MA(0);


RSI_Value = RSI(Close,RSI_Period);

Exit_MA = Average(Close, MA_Exit_Period);

If (RSI_Value <= RSI_Overbought) then buy this bar at close;

If (MarketPosition <> 0 ) And (Close > Exit_MA ) then sell this bar at close;


If (RSI_Value >= RSI_OverSold) then sellshort this bar at close;

If (MarketPosition <> 0 ) And (Close < Exit_MA ) then buytocover this bar at close;

SetStopLoss(stop_loss);

 

Link to comment
Share on other sites

Inputs: AvgPeriod1(17), AvgPeriod2(17), LRSlopePeriod(12);
    
    Variables:  TotalPrice(0), Trend(0), MAL(0), MAH(0), C1(false), C2(false);
   
    { calcs }
    TotalPrice = (O+H++L+C) / 4;
    MAL = Average(Low, AvgPeriod1);
    MAH = Average(High, AvgPeriod2);
    Trend = LinearRegSlope(TotalPrice, LRSlopePeriod);
    C1 = Trend[1] > 0;
    C2 = Trend[1] < 0;

    { long entry logic }
    If MarketPosition = 0 and C1 then
    Buy ("LE") next bar at MAL[1] Limit;

    { short entry logic }
    If MarketPosition = 0 and C2 then
    SellShort ("SE") next bar at MAH[1] Limit;

    { exits }
    If MarketPosition = 1 and C2 then
    Sell ("LX") next bar at MAH[1] Limit;

    If MarketPosition = -1 and C1 then
    BuyToCover ("SX") next bar at MAL[1] Limit;

 

Link to comment
Share on other sites

Input: Length(10), BrkOuts(2), TrailStp(6),  exit_proft(1000);

Vars: HighChannel(0), LowChannel(0), BreakOutCounter(0), BreakUnderCounter(0);

HighChannel = Highest( High , Length )[1];
LowChannel = Lowest( Low , Length )[1];

If High > HighChannel then Begin
    BreakOutCounter = BreakOutCounter+ 1;
    BreakUnderCounter = 0;
End;

If Low < LowChannel then Begin
    BreakUnderCounter = BreakUnderCounter + 1;
    BreakOutCounter= 0;
End;

If BreakOutCounter >= BrkOuts then Begin
    Buy this bar on Close;
    BreakOutCounter = 1;
End;
If BreakUnderCounter >= BrkOuts then Begin
    Sellshort this bar on Close;
    BreakUnderCounter = 1;
End;

{Sell next bar at Lowest( Low , TrailStp ) Stop;
Buytocover next bar at Highest( High , TrailStp ) Stop;}

SetProfitTarget (exit_proft);

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...