Stoch EA

 

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

Files:
image1.gif  11 kb
imagem_2.jpg  67 kb
 

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); }

 

Hello,

I am interested by the results of the week. I see that you uses the Stoch indicator, but which periods? and which are these datum lines (20-80?) Thank you to entirely explain us all your method.

 

I have just found on another forum, the same message with the adjustment of stoch: 10,6, but MA"Metod": Low/High ?? and the Field of the price : Exponentiel ?

confirm these details or thank you put all the details of your method.

 

Results

BrunoFX:
Hello, I am interested by the results of the week. I see that you uses the Stoch indicator, but which periods? and which are these datum lines (20-80?) Thank you to entirely explain us all your method.

Hi Bruno..

Its only EurUsd (M5), my settings are 10;6:6 and the lines (20-80)..

Price Field: H/L;

MA method: Linear Weigthed

EurUsd Day 14

Close @ P/L

Buy 1,1729 1,1734 5

Sell 1,1734 1,1726 8

Buy 1,1726 1,1765 39

Buy 1,1736 1,1765 29

Sell 1,1765 1,1763 2

Buy 1,1763 1,1761 -2

Buy 1,1753 1,1761 8

Sell 1,1761 1,1741 20

Buy 1,1741 1,1697 -44

Buy 1,1730 1,1697 -33

Buy 1,1705 1,1697 -8

Buy 1,1665 1,1697 32

Sell 1,1697 1,1687 10

66

EurUsd Day 15

Close @ P/L

Buy 1,1687 1,1709 22

Buy 1,1691 1,1709 18

Buy 1,1693 1,1709 16

Buy 1,1689 1,1709 20

Sell 1,1709 1,1660 49

Buy 1,1660 1,1662 2

Sell 1,1662 1,1697 -35

Sell 1,1696 1,1697 -1

Buy 1,1697 1,1718 21

Sell 1,1718 1,1721 -3

109

EurUsd Day 16

Close @ P/L

Buy 1,1721 1,1730 9

Buy 1,1717 1,1730 13

Sell 1,1730 1,1721 9

Buy 1,1721 1,1723 2

Buy 1,1710 1,1723 13

Buy 1,1718 1,1723 5

Sell 1,1723 1,1686 37

Buy 1,1686 1,1685 -1

Buy 1,1657 1,1685 28

Sell 1,1685 1,1668 17

Sell 1,1687 1,1668 19

151

EurUsd Day 17

Close @ P/L

Buy 1,1668 1,1681 13

Sell 1,1681 1,1674 7

Buy 1,1674 1,1692 18

Buy 1,1665 1,1692 27

Buy 1,1670 1,1692 22

Buy 1,1654 1,1692 38

Sell 1,1692 1,1676 16

Buy 1,1676 1,1712 36

Sell 1,1712 1,1714 -2

Buy 1,1714 1,1752 38

Sell 1,1752 1,1743 9

Sell 1,1755 1,1743 12

234

EurUsd Day 18

Close @ P/L

Buy 1,1743 1,1766 23

Buy 1,1745 1,1766 21

Buy 1,1719 1,1766 47

Buy 1,1681 1,1766 85

Buy 1,1688 1,1766 78

Sell 1,1766 1,1709 57

Buy 1,1709 1,1749 40

351

EurUsd Day 18

Close @ P/L

Sell 1,1775 1,1771

Buy 1,1771 1,1803 32

Buy 1,1770 1,1803 33

Buy 1,1773 1,1803 30

Sell 1,1803 1,1813 -10

Sell 1,1814 1,1813 1

Buy 1,1813 1,1811 -2

Buy 1,1814 1,1811 -3

Buy 1,1813 1,1811 -2

Sell 1,1811 1,1721 90

169

NOTE: I dont trade all this, sometimes I lose the signal and other times I sleep...

 

with the stoch all alone step easy to be able to know what it can occur. I have just tested with the ADX and there one sees there much better. I attach you a scan to better see. It is necessary that the crossing of Stoch is confirmed by the crossing of the ADX in the same direction with +19 and line ADX (green) + 25. I added the pivot and the channel like visual indicator

Files:
 

Your Rules?

Hi Hellkas,

I like the Stochastic Cross too. I have some questions about your rules:

Do you enter on every stochastic cross that occurs outside the 20/80 lines?

At any time of the day when you are available?

You say that the MA method is linear weighted but you haven't shown an MA on your charts, or told us how you use an MA and what its period value is?

What are your exit rules?

Can you enter a 2nd long position when you are already long in the market?

Can you be in a long position and a short position at the same time?

Thanks

 

My Rules

Hi Barry...

barry:
Do you enter on every stochastic cross that occurs outside the 20/80 lines?

Yes; I only buy when the green line its <= 20 and cross de red line.

barry:
At any time of the day when you are available?

I live in Porto Portugal so I'm available since 8:00 AM 1:00 AM.. I trade all European and US Session and a little Asian..

barry:
You say that the MA method is linear weighted but you haven't shown an MA on your charts, or told us how you use an MA and what its period value is?

No Barry, I dont use any MA.. This MA I mention is the settings of stoch..

barry:
What are your exit rules? Can you be in a long position and a short position at the same time?

No, if I go long I wait the green line => 80 and after this when the green line cross de red line I exit my long and open short..

barry:
Can you enter a 2nd long position when you are already long in the market?

Yes, always wait for the sell signal.. In day 18 I open 5 longs.. (See my results)

Note Barry:

hellkas:
NOTE: I dont trade all this, sometimes I lose the signal and other times I sleep...

These results are if it had a EA that it followed rigorously these rules...

Thank you

hellkas

 

Hellkas, I made EA per your rules (as I understand them). Please, make tests and see if this is what you want and compare your manual test to EA backtest.

https://www.mql5.com/en/forum/173147

 

Stoch

Hi, Hellkas!

Can you upload your Stoch indicator?

Thank you!

 

IS the EA only for eur/usd m5 chart?

Thanks

Sada

Reason: