Here is a copy of the EA that I am working with.
I downloaded it free form forex-tsp/forums.
Very effective and simple to use, I just want to add the BB…or any other suggestions an more experianced trader may have to go with the goal of fewer trades for high % profit. I dont know how to save it as attachment…so here it is.
#property copyright “newdigital”
#property link “http://www.forex-tsd.com”
#define MAGIC 751518
extern double lStopLoss = 200;
extern double sStopLoss = 200;
extern double lTakeProfit = 400;
extern double sTakeProfit = 400;
extern double lTrailingStop = 10;
extern double sTrailingStop = 10;
extern color clOpenBuy = Blue;
extern color clCloseBuy = Aqua;
extern color clOpenSell = Red;
extern color clCloseSell = Violet;
extern color clModiBuy = Blue;
extern color clModiSell = Red;
extern string Name_Expert = “RSI”;
extern int Slippage = 4;
extern bool UseHourTrade = false;
extern int FromHourTrade = 9;
extern int ToHourTrade = 17;
extern bool UseSound = false;
extern string NameFileSound = “alert.wav”;
extern double Lots = 0.01;
extern int RSIPeriod=14;
void deinit() {
Comment("");
}
//±-----------------------------------------------------------------+
//| |
//±-----------------------------------------------------------------+
int start(){
if (UseHourTrade){
if (!(Hour()>=FromHourTrade && Hour()<=ToHourTrade)) {
Comment(“Time for trade has not come else!”);
return(0);
} else Comment("");
}else Comment("");
if(Bars<100){
Print(“bars less than 100”);
return(0);
}
if(lStopLoss<10){
Print(“StopLoss less than 10”);
return(0);
}
if(lTakeProfit<10){
Print(“TakeProfit less than 10”);
return(0);
}
if(sStopLoss<10){
Print(“StopLoss less than 10”);
return(0);
}
if(sTakeProfit<10){
Print(“TakeProfit less than 10”);
return(0);
}
double diRSI0=iRSI(NULL,0,RSIPeriod,PRICE_CLOSE,0);
double diRSI1=iRSI(NULL,0,RSIPeriod,PRICE_CLOSE,0);
if(AccountFreeMargin()<(1000*Lots)){
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}
if (!ExistPositions()){
if ((diRSI0>80)){
OpenSell();
return(0);
}
if ((diRSI0>90)){
OpenSell();
return(0);
}
if ((diRSI1<20)){
OpenBuy();
return(0);
}
if ((diRSI1<10)){
OpenBuy();
return(0);
}
}
TrailingPositionsBuy(lTrailingStop);
TrailingPositionsSell(sTrailingStop);
return (0);
}
bool ExistPositions() {
for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==Symbol() && OrderMagicNumber()==MAGIC) {
return(True);
}
}
}
return(false);
}
void TrailingPositionsBuy(int trailingStop) {
for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==Symbol() && OrderMagicNumber()==MAGIC) {
if (OrderType()==OP_BUY) {
if (Bid-OrderOpenPrice()>trailingStopPoint) {
if (OrderStopLoss()<Bid-trailingStopPoint)
ModifyStopLoss(Bid-trailingStopPoint);
}
}
}
}
}
}
void TrailingPositionsSell(int trailingStop) {
for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==Symbol() && OrderMagicNumber()==MAGIC) {
if (OrderType()==OP_SELL) {
if (OrderOpenPrice()-Ask>trailingStopPoint) {
if (OrderStopLoss()>Ask+trailingStopPoint || OrderStopLoss()==0)
ModifyStopLoss(Ask+trailingStopPoint);
}
}
}
}
}
}
void ModifyStopLoss(double ldStopLoss) {
bool fm;
fm = OrderModify(OrderTicket(),OrderOpenPrice(),ldStopLoss,OrderTakeProfit(),0,CLR_NONE);
if (fm && UseSound) PlaySound(NameFileSound);
}
void OpenBuy() {
double ldLot, ldStop, ldTake;
string lsComm;
ldLot = GetSizeLot();
ldStop = GetStopLossBuy();
ldTake = GetTakeProfitBuy();
lsComm = GetCommentForOrder();
OrderSend(Symbol(),OP_BUY,ldLot,Ask,Slippage,ldStop,ldTake,lsComm,MAGIC,0,clOpenBuy);
if (UseSound) PlaySound(NameFileSound);
}
void OpenSell() {
double ldLot, ldStop, ldTake;
string lsComm;
ldLot = GetSizeLot();
ldStop = GetStopLossSell();
ldTake = GetTakeProfitSell();
lsComm = GetCommentForOrder();
OrderSend(Symbol(),OP_SELL,ldLot,Bid,Slippage,ldStop,ldTake,lsComm,MAGIC,0,clOpenSell);
if (UseSound) PlaySound(NameFileSound);
}
string GetCommentForOrder() { return(Name_Expert); }
double GetSizeLot() { return(Lots); }
double GetStopLossBuy() { return (Bid-lStopLossPoint);}
double GetStopLossSell() { return(Ask+sStopLossPoint); }
double GetTakeProfitBuy() { return(Ask+lTakeProfitPoint); }
double GetTakeProfitSell() { return(Bid-sTakeProfitPoint); }