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
Ichimoku Kinko Hyo Cross only opens Buy's!
Hello All,
Have been programming for the past few weeks and coming along reasonably well. But I have hit a point here where my latest fairly simple system that I am trying to code will not work for me. I have re written it about five times, using different code, tried Expert Advisor builders and altering other cross strategies e.t.c. but the system will only ever open Buy Trades. (Among other problems I have) any help would be much appreciated as it seems like it could be a profitable system. (Ok everyone seems to think this when programming them, but manual bar by bar backtests show a positive outcome.)
THE SYSTEM: Chart Setup
The Ichimoku Kinko Hyo indicator with default 9,26,52 settings. Only show the Tenkan-Sen and Kijun-Sen, hide the Senkou and Chikou lines.
FIRST ENTRY (explained for long/buy - same applies for sell in op. direction)
Tenkan-Sen crosses Kijun-Sen and price is above KIJUN-Sen. Stop loss the amount of the pairs spread below Tenkan-Sen. Trail with stop at Kijun-Sen - spread pips unless reverse signal occurs (where you close).
RE-ENTRY (sometimes a few trades get stopped out before catching the "big ride"
If stop loss is hit, before crossing of Tenkan-Sen and Kijun-Sen a position can be reopened if the price closes above the TENKAN-Sen and the Tenkan-Sen is still above the Kijun-Sen. Stop loss as before.
SUMMARY
Enter long when Tenkan-Sen Crosses above Kijun-Sen. Stop loss a spreads distance below Kijun-Sen. If stopped out before cross and reversal occurs, can re-enter a long position if price rises above Tenkan-Sen. No Take Profit, just trail the stop loss on the Kijun-Sen.
This system does tend to like trends, but the losses should not be too great in the range-bound markets. I plan to trade on daily TF's but possible others when I get the Expert running. In fact, on some markets I have tested, the EA is profitable at the moment, before its even working properly!
MQ4 attached if anyone can decipher where I am going wrong!
Thanks,
Howard
P.S. It would be great to receive some help on this as its my Birthday tommorow and it would be very nice to receive some help!
I also apologise to all the Ichimoku practitioners out there that feel it should not be automated as it is meant to be trading the market "at a glance". However I feel the indicator is so wonderful, especially the Kijun-Sen, which trades just outside the retracements in many long trends that it is perfect for automation!
im writing an EA that buys and sells the EMA crosses.. I want to filter it by checking if the last 10 bars closes were above the EMA before buying... can anyone help me???
bool OkToBuy()
{
for(int j = 1, j < 11, j ++) if(Close[j] < EMA) return(false);
return(true);
}
bool OkToBuy()
{
for(int j = 1, j < 11, j ++) if(Close[j] < EMA) return(false);
return(true);
}
Thanks so much for this Michel..
This was one of those things that just stumped me but now i feel like a fool for overthinking.. haha... THANKS AGAIN!!!
How To Code!!
I Think This Ea Is Very Good...
But Only Open One Order In One Pair...why?
To adria
adria
I got interested in your problem and played with it.
It looks like you need to do something like this:
First, declare Var1, Var2 globally.
Then try this:
if (Hour() == 12) Var1 = iHigh(NULL,0,1);
if (Hour() == 12) Var2 = iLow(NULL,0,1);
The Metaeditor Navigator gives explanation of Hour().
Search TSD for "trading hours" for more examples.
If your EA shows promise, could you shoot me a copy?
Big Be
To Big Be
I created the similar EA. You have to change TIME value according to your
chart time.
need help with this function closealltrades
I notice broker sometimes requote the price causing the EA not to close
the order. How can I prevent the EA to continue until all of orders according
to its magic number is closed, maybe put a sleep function for 5 second and
a while loop to check and close the orders before continue. Below is the
closealltrades function. Appreciate the help and thanks in advance.
void CloseAllTrades()
{
int rc;
int cnt;
for(cnt=OrdersTotal()-1;cnt>=0;cnt--)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if (OrderMagicNumber()==GetMagicNumber())
{
rc= OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), MarketInfo(OrderSymbol(), MODE_SPREAD), Yellow);
if(!rc)
Log("Close error="+GetLastError());
}
}
}
I notice broker sometimes requote the price causing the EA not to close
the order. How can I prevent the EA to continue until all of orders according
to its magic number is closed, maybe put a sleep function for 5 second and
a while loop to check and close the orders before continue. Below is the
closealltrades function. Appreciate the help and thanks in advance.
void CloseAllTrades()
{
int rc;
int cnt;
for(cnt=OrdersTotal()-1;cnt>=0;cnt--)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if (OrderMagicNumber()==GetMagicNumber())
{
rc= OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), MarketInfo(OrderSymbol(), MODE_SPREAD), Yellow);
if(!rc)
Log("Close error="+GetLastError());
}
}
}bool IsAllClosed ; //Global variable
void CloseAllTrades()
{
int cnt;
IsAllClosed = true;
for(cnt=OrdersTotal()-1;cnt>=0;cnt--)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if (OrderMagicNumber()==GetMagicNumber())
IsAllClosed = IsAllClosed && OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), MarketInfo(OrderSymbol(), MODE_SPREAD), Yellow);
}
}
void start()
{
while(!IsAllClosed) {CloseAllTrades(); return;}
...
thanks
thank you Michel for your help.
I will try it out.
This line while(!IsAllClosed) {CloseAllTrades(); return;}
in the main start will close all open positions if MT goes down
and I start it back up. Is there a way to put this line
in the closealltrades function so it won't close all open positions
after MT4 restart?
thanks.