Forex Lasers Forum

Forex Lasers Forum (https://www.forexlasers.com/forums/)
-   Expert Advisors / Robots (https://www.forexlasers.com/forums/expert-advisors-robots/)
-   -   Help To Fix an Expert Advisor (https://www.forexlasers.com/forums/expert-advisors-robots/187-help-fix-expert-advisor.html)

cwave 07-04-2009 23:16

Help To Fix an Expert Advisor
 
I have an Expert Advisor that I feel has potential but can't get it to close a trade on a signal in the opposite direction. I was in on a sell when a buy was suppose to execute and didn't. A buy should have opened and close the sell on the next candle. Could someone please look.

Thanks in advance.
cwave:mad:

jezzer1961 08-04-2009 07:13

Quote:

Originally Posted by cwave (Post 1899)
I have an Expert Advisor that I feel has potential but can't get it to close a trade on a signal in the opposite direction. I was in on a sell when a buy was suppose to execute and didn't. A buy should have opened and close the sell on the next candle. Could someone please look.

Thanks in advance.
cwave:mad:

You'll need to either attach the EA or paste the code if you want somebody to look at it.

I've heard that Telepathic Debugging will be a major feature of MT5, but MetaQuotes haven't got a release date yet. :)

cwave 08-04-2009 09:50

2 Attachment(s)
Quote:

Originally Posted by jezzer1961 (Post 1907)
You'll need to either attach the EA or paste the code if you want somebody to look at it.

I've heard that Telepathic Debugging will be a major feature of MT5, but MetaQuotes haven't got a release date yet. :)


Here it is, I saw something on the AshFX Version II Expert Advisor that had a setting on the inputs for "Close on Opposite Signal" that you could set to True or False. My feeling if I could get that installed I would be okay. Thanks for the help.

cwave:)

jezzer1961 08-04-2009 10:35

1 Attachment(s)
Quote:

Originally Posted by cwave (Post 1908)
Here it is, I saw something on the AshFX Version II Expert Advisor that had a setting on the inputs for "Close on Opposite Signal" that you could set to True or False. My feeling if I could get that installed I would be okay. Thanks for the help.

cwave:)

Is this what you want? I haven't tested it, but if you open the source file in the editor and search cwave, you'll be able to see the modifications that I've made.

Enjoy!

cwave 08-04-2009 17:36

1 Attachment(s)
Quote:

Originally Posted by jezzer1961 (Post 1909)
Is this what you want? I haven't tested it, but if you open the source file in the editor and search cwave, you'll be able to see the modifications that I've made.

Enjoy!

Attachment 442

Here's the problem I'm having if you look at the white arrow it should have opened a sell on the open of that candle. I was in on a long position and it didn't do anything when it should have opened a sell and closed my buy. On the previous candle it closed below the 20 SMA and the AO Oscillator has to be red whether it's high or low just as long as it's red. Even though the previous candle is green it should still generate the trade becuase it just needs to close below the 20SMA.

I suspect the coding is set-up where that previous candle needs to be red in order for the trade to generate. If you could please look at that I would appreciate it so much.

Thank you for your help and I hope it makes sense what I just wrote.

Thank again,
cwave

jezzer1961 09-04-2009 11:54

Hi,

The problem I have is in finding the time to look at more complex issues.

When I first looked at it, I thought it was simply a case that you wanted it to close existing trades at the same time as it opened new trades. That was just a simple couple of minutes work and I was happy to help.

I'll have a look at the other problem, but it might be a few days before I even get round to looking at it for you unfortunately.

jezzer1961 09-04-2009 15:04

Quickly looking at the code, the basic rules are that it will go long at the start of a new bar if the previous bar

1) Closed above the ma
2) Had a low below the ma
3) The AO is rising

The opposite applies to shorts.

So with your trade that wasn't taken, it appears to be because the high of the bar wasn't above the ma.

You can easily adjust this yourself in lines 129 and 134 of the code if you feel it will improve things. I suggest you type // before the && Low and hit a return between the ma_cur and the ). This will mean that you can quickly reinstate things by removing the 2 slashes if the idea doesn't work in testing as intended.

If you alse look at line 75 there is a option for entering on bar close only which is set to true. If you type extern in front of bool, you will be able to experiment with entering on the current price bar.


All times are GMT. The time now is 22:48.

Powered by vBulletin® Version 3.8.10
Copyright ©2000 - 2019, vBulletin Solutions, Inc.