pighead:
Read this and implement checking function return values and error reporting: What are Function return values ? How do I use them ?
I am trying to get an EA to activate buys and sells to the following conditions:
if stoch crosses 90 then condition A
if condition A + stoch crosses 50 then sell order plus delete condition A
if stoch crosses 10 then condition B
if condition B + stoch crosses 50 then buy order plus delete condition B
I wonder if I am on the right track with the code below as I am very new to programming:
pighead: I wonder if I am on the right track with the code below as I am very new to programming:
Write self documenting A, 0, 1 are meaningless. Don't write things more than once. (You'll be checking if they're the same and if they differ you'll wonder if they should.)if ((iStochastic(NULL,PERIOD_M5,5,3,3,MODE_SMA,1,MODE_MAIN,0)<10)) // Operator 'if' with a condition A=1; // stochastic crosses 10 then A is marked : if((iStochastic(NULL,PERIOD_M5,5,3,3,MODE_SMA,1,MODE_MAIN,0)>50)) AND A=1 // Here is your open buy : A=0
#define OP_NONE = -1 int eTradeDirection = OP_NONE; // Buy, sell or waiting. : double stoch = iStochastic(NULL,PERIOD_M5,5,3,3,MODE_SMA,1,MODE_MAIN,0); if(stoch<10) eTradeDirection = OP_BUY; : if(stoch >50 && eTradeDirection = OP_BUY) // time to open : eTradeDirection = OP_NONE; // Opened, Determine direction for next one

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I am trying to get an EA to activate buys and sells to the following conditions:
if stoch crosses 90 then condition A
if condition A + stoch crosses 50 then sell order plus delete condition A
if stoch crosses 10 then condition B
if condition B + stoch crosses 50 then buy order plus delete condition B
I wonder if I am on the right track with the code below as I am very new to programming:
Many thanks for reading/insults etc...