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 Sun May 12, 2024 1:21 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: EA with Cycle indicator
PostPosted: Thu Jul 12, 2012 4:13 am 
Offline

Joined: Thu May 31, 2012 3:09 am
Posts: 8
Hi
I have got an indicator- Cycleidentifier- that is to complicated for me . I was trying to analyze the code and guess that:
mode 1= double spike buy
mode 2= double spike sell
mode 3= single spike buy
mode 4= single spike sell.
The simple condition e.g. : buy if Indictaor mode 1 < 0 doesn't work. I have checked many combinations and nothing.
Maybe there is a problem with an empty value ?
I would like to:
1. buy if double (or single) spike -buy appears
2. sell if double (or single) spike-sell appears

Thank you very much
regards
Pawel


Attachments:
CycleIdentifier2.mq4 [12.6 KiB]
Downloaded 450 times
Top
 Profile  
 
 Post subject: Re: EA with Cycle indicator
PostPosted: Thu Jul 12, 2012 9:06 am 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
Does the import work?
Please post the .mol file you have so far


Top
 Profile  
 
 Post subject: Re: EA with Cycle indicator
PostPosted: Thu Jul 12, 2012 3:31 pm 
Offline

Joined: Thu May 31, 2012 3:09 am
Posts: 8
Hi
Import works. But nothing more.
:cry:


Attachments:
Cycle.mol [10.15 KiB]
Downloaded 540 times
Top
 Profile  
 
 Post subject: Re: EA with Cycle indicator
PostPosted: Sat Jul 14, 2012 3:01 pm 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
#property indicator_color2 Lime
#property indicator_color3 Red
#property indicator_color4 DarkGreen
#property indicator_color5 Brown
tells you mode 1=lime
mode 2=red ... etc

These code tells you the signal name
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,3);
SetIndexBuffer(1,MajorCycleBuy);

SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID,3);
SetIndexBuffer(2,MajorCycleSell);

SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID,1);
SetIndexBuffer(3,MinorCycleBuy);

SetIndexStyle(4,DRAW_HISTOGRAM,STYLE_SOLID,1);
SetIndexBuffer(4,MinorCycleSell);
So mode 1=MajorCycleBuy
mode 2=MajorCycleSell

Thus mode 1=lime for MajorCycleBuy.. I think you have it right. The thing here is that you want to trade the current bar but the indicator recalculates the current bar so you miss the signals. Try changing the shift to 1 to trade the previous bar. This kind of indicators show perfect signals after the fact when looking at historical info but when trading it life are not that perfect.
Also, you don't need the cl and cs icons. I think you want to be in the market and by default a sell closes all buys before executing the sell so the cl and cs are not needed (unless you hedge)


Top
 Profile  
 
 Post subject: Re: EA with Cycle indicator
PostPosted: Tue Jul 17, 2012 3:57 am 
Offline

Joined: Thu May 31, 2012 3:09 am
Posts: 8
Thank you. It works.
Is there any way to make a condition:
buy if CCI > 0 and the last spike was double buy. Last - I mean not only shift 1. For example there is a double spike buy, but CCI crosses 0-line after a few (unknown number) candles ?


Top
 Profile  
 
 Post subject: Re: EA with Cycle indicator
PostPosted: Tue Jul 17, 2012 11:26 am 
Offline

Joined: Sun Jun 19, 2011 9:38 pm
Posts: 270
:idea: If you have TIB, set this up in 2 Indicator blocks within one moi. Import your cycle indi same as in SB. In one block, set Advanced Formula = High and Advanced Period to your desired number(n) of lookback bars. Then do Advanced Formula = High in the second block (same period). This will build a new indi that has Mode 0 = cycle High for n periods, and Mode 1 = cycle Low for n periods.

If you want to look for a spike at twice the level of the last one, you will have to code either in an MQL block or in MetaEditor (SB Pro). In mql4 code, I would use OrderSelect to select the last order and then compare the price of that order to the current value (price level) of your newly created indi (above). You can research mql commands like OrderSelect at mql4.com and probably find example code to copy too.

_________________
I'm not a programmer, but I play one on TV.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 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