I was doing something simular but this is not 100 exact to your picture. Dont run this live unless you know what your doing and even then still dont run it live:P let meh know what pairs and settings you have any good results with
#property copyright "Lowphat"
#define MAGIC 934478
extern double lStopLoss = 30;
extern double sStopLoss = 30;
extern double lTakeProfit = 30;
extern double sTakeProfit = 30;
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 = "Phatz CCI";
extern int Slippage = 5;
extern bool UseSound = True;
extern string NameFileSound = "alert.wav";
extern double Lots = 0.10;
void deinit() {
Comment("");
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start(){
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 diStochastic0=iStochastic(NULL,30,5,3,3,MODE_EMA,PRICE_CLOSE,MODE_MAIN,0);
double diStochastic1=iStochastic(NULL,30,5,3,3,MODE_EMA,PRICE_CLOSE,MODE_MAIN,0);
double diStochastic2=iStochastic(NULL,30,5,3,3,MODE_EMA,PRICE_CLOSE,MODE_SIGNAL,0);
double diStochastic3=iStochastic(NULL,30,5,3,3,MODE_EMA,PRICE_CLOSE,MODE_MAIN,0);
double diStochastic4=iStochastic(NULL,30,5,3,3,MODE_EMA,PRICE_CLOSE,MODE_MAIN,0);
double diStochastic5=iStochastic(NULL,30,5,3,3,MODE_EMA,PRICE_CLOSE,MODE_SIGNAL,0);
if(AccountFreeMargin()<(1000*Lots)){
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}
if (!ExistPositions()){
if ((diStochastic0diStochastic2)){
OpenBuy();
return(0);
}
if ((diStochastic3>75 && diStochastic4<diStochastic5)){
OpenSell();
return(0);
}
}
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 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-lStopLoss*Point);}
double GetStopLossSell() { return(Ask+sStopLoss*Point); }
double GetTakeProfitBuy() { return(Ask+lTakeProfit*Point); }
double GetTakeProfitSell() { return(Bid-sTakeProfit*Point); }
hi all...
If anyone can help me I really appreciated..
I have trade manually, but I have to be always in front the computer and this occupies me much time..
Chart: EurUsd (M5)
Indicator: Stoch
Rules: I don't speak very well English and as not to induce nobody in error, please see image
if anyone will be interested, I show the results of the last week..
Many thx