Hi Adam
Would love to help but your description is a bit vague.
1. What do you mean by about the 62? "If the 5 and 20 cross up and the 62 as underneath the cross it is a buy (however, if the 62 is above the cross up but the price closes "about the 62", then we still take the buy)"
2. How do you enter the engulfing candles? What is the re-entry criteria? Do you place a market order or a pending order? Also, if a re-entry occurs what will be your stoploss?
3. I noticed that you don't place any sell orders? Is there a specific reason for this?
4. I could not see any attachments?
Thank you,
DTK-Forex
Hello All,
I have the basic code now finished and the logic in place, but it seems like the MT4 back tester has a mind of its own. My friend and I are stumped and have been trying to trouble shoot the code, and are left with unanswered questions. I thought I would reach out to you and lay my cards on the table. I was wondering if I showed you my trade and what I’m trying to do, maybe you can take a look at it and give me your opinion on what is going wrong.
There are no pictures attached . . .
You haven't actually said what your problem is ? what is your code doing that it shouldn't or not doing what it should be doing ?
I can see you aren't checking return values fro your trade functions, don't you want to know if they fail ? and if they fail what the error was ? and if there was an error what the values of Bid, Ask, trade entry, SL, TP, etc were at the time ?
Read this: What are Function return values ? How do I use them ?
If you have an open order and MT4 crashes when you restart it and your EA finds the open trade where does it get the correct value of ticket from ? your EA needs to be able to pick up from where it left of in the case of a unexpected termination . . . this will help a little: Loops and Closing or Deleting Orders
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello All,
A friend of mine, who has a lot of experience coding in PHP and other languages, and I have been working together to a code an EA for a few weeks. This particular system that we are trying to code is one that my partner and I have manually back tested and traded for a few years now. we developed this trading strategy to be completely objective, so to take all of our emotions out of the market, and because it is objective it is programmable. I have made some money off of it, but because of my crazy school and work schedule I haven’t realized the trade’s true potential. For the last 4 years my strategy would have doubled my account about 5 times a year, with the greatest drawdown of about 25 percent… Recently I came to the realization that an EA would greatly enhance my chances for success, making every trade, and without emotion. For these reasons I have begun the process of coding my first EA.
I have the basic code now finished and the logic in place, but it seems like the MT4 back tester has a mind of its own. My friend and I are stumped and have been trying to trouble shoot the code, and are left with unanswered questions. I thought I would reach out to you and lay my cards on the table. I was wondering if I showed you my trade and what I’m trying to do, maybe you can take a look at it and give me your opinion on what is going wrong.
This is my trade:
I trade the EUR/USD and the EJ
Time Frame: 4h
3 EMAS: 5, 20, 62
For a buy:
If the 5 and 20 cross up and the 62 as underneath the cross it is a buy (however, if the 62 is above the cross up but the price closes about the 62, then we still take the buy)
Our take profit is when the price closes below the 5 EMA
Our stop is a trailing stop of 60 pips, trailing in 10 pip increments. However, if the price reaches positive 50 pips we move stops to 0.
The next part of the trade that isn’t included in my code that is figured into my manual trading strategy is a reentry if there is a engulfing candle. We only take these engulfing candles if the price pulls back to at least the 20EMA but not so far as to cross the 20EMA through the 62.
Thanks so much,
Adam King - Attached are a couple of pictures to clarify what my strategy....