molanis.com/forum - Tools for MetaTrader : The place to ask about the best expert advisor builder, expert advisor downloads, and expert advisor programming

AFTER YOU REGISTER SEND US AN EMAIL TO ACTIVATE YOUR ACCOUNT - Before posting:-1- Please read the user guide -2- Try the examples -3- Search in the forum
It is currently Wed May 15, 2024 12:48 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: MAcross with Osc of Moving Averages
PostPosted: Fri Feb 24, 2012 6:40 am 
Offline

Joined: Sun Oct 30, 2011 9:05 pm
Posts: 12
Hi, I am trying to make EA with( 3, 5) Moving Average and Oscillator of Moving average.(12,29,9)
The oscilator is usally displayed as a histogram and i'd like to have a buy signal above zero line and a sell signal below zero line.
the moving average to open a buy on a crossover 3ma and 5ma as long as Oscillator is above zero line on histogram.& sell visa versa.
I include the Mol file, my design is flawed somewhere, as backtests show nothing.
The validation shows up as ok but i am missing something, i suspect with Oscillator of Moving Averages.
i tried layout as per examples but i am missing something. can you have a look and tell me where i am wrong.
I get smiley face just no buys/sells
thanks cheers Baz


Attachments:
baz3x5moav2.mol [11.13 KiB]
Downloaded 353 times
Top
 Profile  
 
 Post subject: Re: MAcross with Osc of Moving Averages
PostPosted: Fri Feb 24, 2012 10:39 am 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
I would say that you should start backtesting the ma example strategy from the expert advisors example page http://www.molanis.com/products/molanis ... rs-for-mt4
Your ma conditions seem fine but using periods 3 and 5 does not make too much sense (unless you try to scalp) - One period should be longer.
Your iosma conditions are wrong. You need to compare the indicator with a number and not to itself
You said it: "buy signal above zero line and a sell signal below zero line." so you should compare it to zero.
Again, look at the examples, I think the rsi example compares the indicator to a number.
Also, it qould be better if you test first the ma and the iosma separatedly to make sure they work, and they join them


Top
 Profile  
 
 Post subject: Re: MAcross with Osc of Moving Averages
PostPosted: Fri Feb 24, 2012 2:56 pm 
Offline

Joined: Sun Oct 30, 2011 9:05 pm
Posts: 12
Thankyou, I corrected it, i was trying to use the shift zero on the indicator, its working.
It opens and closes buys/sells at those points when criteria is met,beautifully.
But i am also trying to open and close when the moving average is crossed.
So say a buy is triggered by Oscillator and MA, later when the MA reverses i like to close the buy.
Then as long as oscillator is above zero, buy again when the MA un-crosses again,
viser verser with sells.
Ive been arranging the blocks and trying things but im missing something.
I presume i add a close long and close short but where to, as i cant validate it.
Its not your product, its my brain! lol cheers Baz


Top
 Profile  
 
 Post subject: Re: MAcross with Osc of Moving Averages
PostPosted: Sat Feb 25, 2012 12:14 am 
Offline

Joined: Sun Oct 30, 2011 9:05 pm
Posts: 12
Hi I added Mol. file. (I couldnt upload it last night)
Ive tried adding close longs/close shorts and moving blocks around in various combinations.

ie: it buys when MA & Oscillator conditions are met,thats great but i like to close long when MA un-crosses.
and then re buy when MA crosses back, while Oscillator conditions remain in place.
So say on a larger timeframe the MA may cross over many times while Oscillator remains above zero trigger line.

I keep getting errors on the flow chart, can you advise me please as to the correct arrangement so as to facilitate above.
Thanks very much cheers Baz


Attachments:
baz3x5maov3.mol [10.56 KiB]
Downloaded 374 times
Top
 Profile  
 
 Post subject: Re: MAcross with Osc of Moving Averages
PostPosted: Sat Feb 25, 2012 8:02 am 
Offline

Joined: Sun Oct 30, 2011 9:05 pm
Posts: 12
Heres my latest effort,i cant validate it but can you tell me what i am doing wrong?
cheers Baz


Attachments:
baz3x5moa errors.mol [18.3 KiB]
Downloaded 345 times
Top
 Profile  
 
 Post subject: Re: MAcross with Osc of Moving Averages
PostPosted: Sat Feb 25, 2012 10:23 am 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
Did you try the ma ea and the iosma ea separately?
Your ea seems fine. In most eas you don need to use the CL, CS icons top close positions. Since the ea will close shorts before going long and viceversa.
In this case you can use the ea without CL and CS. Or you can use it to close positions when the market changes directions - I mean from ma1> ma2 to ma 1 < ma2 - if you want this, do not use iosma to close, you only close based on ma.


Top
 Profile  
 
 Post subject: Re: MAcross with Osc of Moving Averages
PostPosted: Sat Feb 25, 2012 1:31 pm 
Offline

Joined: Sun Oct 30, 2011 9:05 pm
Posts: 12
Hi,sorry to bother you again but i justed wanted to clarify about the strategy.
I would like when the 3MA> 5MA to open a buy but only if the Oscillator is above zero line.(histogram)
It is currently doing this, no probs.
The prob i am having is, i would like when 3MA< 5MA to close the order,even if Oscillator is above zero line. Its not doing this. Doing this i can eliminate a bit of chop because i am only trading in direction of oscillator.
I dont want it to automatically open a reverse position,just close and be out of the market.
The prob i am have is moving the schematic blocks to be able to do this. Its probably very simple but Im just not getting it.
Baz


Top
 Profile  
 
 Post subject: Re: MAcross with Osc of Moving Averages
PostPosted: Sun Feb 26, 2012 4:32 am 
Offline

Joined: Sun Oct 30, 2011 9:05 pm
Posts: 12
Hi I have taken off the oscillator on the cl/cs as per your advice.
it validated, i will test it tomorrow as it didnt generate EA in mt4,i presume they are doing maint.
I will get back to you with results. Again thanks for your patience, i am learning a lot each time .
Baz


Attachments:
baz3x5moav4.mol [15.06 KiB]
Downloaded 376 times
Top
 Profile  
 
 Post subject: Re: MAcross with Osc of Moving Averages
PostPosted: Sun Feb 26, 2012 2:45 pm 
Offline

Joined: Sun Oct 30, 2011 9:05 pm
Posts: 12
I just gave it a brief check,it appears to work. Whether its profitable is another story!. lol
Thankyou very much for your help. I'll buy you a beer. cheers Baz


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by Molanis © 2009