Sunday, September 16, 2012

[STAD_01] Buy Bips-Sell Rallies

This System is based on RSI and DMI.
If RSI is over 50 then we assume it is an up trend else down.
Given that assumption we use DMI as buy and sell signal.
ie. if DMI crossed down then we prepare to buy and when DMI crossup the previous high then we buy.
 
 
 
 
 
 
 
 



















Input: RSILen(200), RSILevel(50), DMILen(100), ARmult(2), Div(40);
Vars: UpTrend(False), DnTrend(False), DMISpread(0), MP(0), StopPrice(0), BuySetup(False), SellSetup(False), LongEntryPrice(0), ShortEntryPrice(0);
UpTrend = RSI(RSILen) >= RSILevel;
DnTrend = RSI(RSILEn) < RSILevel;
DMISpread = DIPlus(DMILen) - DIMinus(DMILen);
If UpTrend == true and DMISpread < 0 then {
BuySetup = True;
SellSetup = False;
}
Else
buysetup = false;

If DNTrend == true and DMISpread > 0 then {
SellSetup = True;
BuySetup = False;
}
Else
sellsetup = false;
If EntriesToday(date) < 1 Then {
If BuySetup == true then {
If BuySetup[1] == False then
LongEntryprice = High;
Buy("Buy",AtStop,LongEntryPrice);
}
If SellSetup == True then {
If SellSetup[1] == False then
ShortEntryPrice = Low;
Sell("Sell",AtStop, ShortEntryprice);
}
}
MP = MarketPosition();
If MP == 1 and MP[1] <> 1 then
StopPrice = Low - MA(Range,40)*ARmult;
If MP == -1 and MP[1] <> -1 then
StopPrice = High + MA(Range,40)*ARmult;
If MP == 1 then {
Exitlong("EL", atStop, StopPrice);
StopPrice = StopPrice + (Low - StopPrice)/div;
}
If MP == -1 then {
Exitshort("ES",AtStop, StopPrice);
StopPrice = StopPrice - (StopPrice - High)/div;
}
setstoploss(1.5);
SetStopEndofday(1500);

No comments:

Post a Comment