Coding questions ... - page 3

 

found it

i found the rsi bands indicator by mladen.

thank you and best regards,

mike

 

Some help please with ZigZag and RVI indicators for me to code 2 EAs

Hi,

I wish to build 2 separate EAs. Each one will use either the RVI or the Zigzag indys as triggers for trades.

RVI questions:

How do I get from the indy the price and direction of the cross-over point. Related to this is how to get the level the indy is at, eg I don't want to trigger a sell if the oscillation is below the zero line etc.

I attach the "RVI With Alert" - is there some part of the alert part of the code I can use to trigger the trades and their buy/sell direction? Eg, it creates the alert accurately, can this some how be used to send orders to?

ZigZag questions:

We all know the ZigZag indy repaints the newest line like crazy. I love that about it. How do I get the price and direction of the very first moment the new line appears? Like, if the new line is downward, then I want the Bid price for an OP_SELL etc. I wish to use this to trigger trades to profit from the repainted level.

I've built a few EAs before, but my coding skill is still primitive. Working with Indy buffers etc is very new to me.

Any help gratefully appreciated.

Phil

Files:
 
dancingphil:
Hi,

I wish to build 2 separate EAs. Each one will use either the RVI or the Zigzag indys as triggers for trades.

RVI questions:

How do I get from the indy the price and direction of the cross-over point. Related to this is how to get the level the indy is at, eg I don't want to trigger a sell if the oscillation is below the zero line etc.

I attach the "RVI With Alert" - is there some part of the alert part of the code I can use to trigger the trades and their buy/sell direction? Eg, it creates the alert accurately, can this some how be used to send orders to?

ZigZag questions:

We all know the ZigZag indy repaints the newest line like crazy. I love that about it. How do I get the price and direction of the very first moment the new line appears? Like, if the new line is downward, then I want the Bid price for an OP_SELL etc. I wish to use this to trigger trades to profit from the repainted level.

I've built a few EAs before, but my coding skill is still primitive. Working with Indy buffers etc is very new to me.

Any help gratefully appreciated.

Phil

Hi Phil,

About RVI, there are several ways to code the cross, one would be to start with the iCustom call.

rvi = iCustom(NULL,0,"RVI With Alert",RviPeriod,0,1);

rvisig = iCustom(NULL,0,"RVI With Alert",RviPeriod,1,1);

rvipre = iCustom(NULL,0,"RVI With Alert",RviPeriod,0,2);

rvisigpre = iCustom(NULL,0,"RVI With Alert",RviPeriod,1,2);

Now for buy and sell signals

lf (rvi > rvisig && rvipre <= rvisigpre) buy

lf (rvi = rvisigpre) sell

Another way is using the trend buffer, this example i learned from a post in public volatility quality section by Mladen. This way you are directly calling the trend (#4) buffer. I think this is a very good method to use if for instance you want the Ea to open on trend change and to have it close on trend change and open in opposite direction.

double trendNow = iCustom(NULL,0,"RVI With Alert",RviPeriod,4,1);

double trendPrv = iCustom(NULL,0,"RVI With Alert",RviPeriod,4,2);

if (trendNow!=trendPrv) // trend change

if (trendNow==1)

{

myOrderType = buy; // trend is up

}

else

{

myOrderType = sell; // trend is down

}

return(myOrderType);

}

Now about Rvi, Mladen posted a new version IMHO its better than this version.

Will get back later about Zigzag.

 

Rvi ea

@ MrTools, thank you VERY much for the RVI code snips.

I have attached 2 EAs I just coded using your code - each one using one of your 2 versions of code. Until the markets open I can only guess I stuck them in the correct place. Eg, I never back test as it's too unreliable. For now my work "feels" right.

I would NEVER have guessed how to do it without your code snips; thank you very much!

Perhaps you can tell me how to return the real time RVI value, say for the signal line.

That is, when I know the real time value of one of the lines, then I can add a second/conditional "if" statement to trade outside of a range. And I can allow user-input that filters sell trades to only those above a certain value, and buy trades only below a certain value. It would a be a user option they can turn on or off is what I am planning.

I have really appreciated your help!!! Woohoo! I've never coded 2 EA's in one day , haha even though I don't know they work yet!

I'll await your feedback on the ZigZag issue. The price and direction moment a new line first forms is the main thing I need to know how to return, so that I can trigger trades from it.

Phil

 
dancingphil:
@ MrTools, thank you VERY much for the RVI code snips.

I attach my EA with them added. Until the markets open I can only guess I stuck them in the correct place. Eg, I never back test as it's too unreliable.

How would I be able to get the current moment RVI value, say for the signal line?

That is, when I know the real time value of one of the lines, then I can add a second/conditional "if" statement to trade outside of a range. And I can allow user-input that filters sell trades to only those above a certain value, and buy trades below a certain value. It would a be a user option they can turn on or off

I have really appreciated your help!!! I'll have a play now with the second option you gave.

Phil

Phil forgot to mention there is an Ea here

https://www.mql5.com/en/forum/180383

3rd post

has a close on trend change built in. Far as i know the Ea is error free. Another thing i forgot to mention, when calling indicators to an Ea all i have ever seen is "double" used instead of "int", can't remember the reason but that's the only way i remember seeing them used.

To get your current values

double rvi = iCustom(NULL,0,"RVI With Alert",RviPeriod,0,0);

double rvisig = iCustom(NULL,0,"RVI With Alert",RviPeriod,1,0);

 

About zig zag here's a indicator and Ea for the callout in the Ea its like this

if(iCustom(NULL,GrossPeriod,"ZigAndZag",5,ZZbar)!=0){buy=true;SetArrow(241,1,true,Blue);}

if(iCustom(NULL,GrossPeriod,"ZigAndZag",6,ZZbar)!=0){sell=true;SetArrow(242,1,false,Red);}

ZZbar is an external parameter you can change to whatever you want, the 5th and 6 th buffers though are not what your after i think buffer 0 is the one that draws the section. The GrossPeriod is just an automatic timeframe changer, if your on 15 min chart the GrossPeriod is now 30 min, always 1 timeframe up, also most of the time on zigzag type Ea you will see !=0, this is when the section moves.

Files:
 

@ MrTools; You've put me onto several very interesting resources here to study up on and get it sorted, THANK YOU!

It's been "beer o'clock" here since my "2 EAs in one day" moment .... but even so I am enjoying reading the work of the smarter people who have come before me.

Re ZigZag:

I especially like the idea of using "GrossPeriod" but in reverse for profit taking OrderClose triggers; that is, use the first appearance of a new line that occurs on the next smallest time frame to close trades. This may solve the problem of leaving too many pips on the table with larger price breakouts if I were instead to use a nominal TakeProfit pips method. But until I code and test it, it could be just the beer doing my thinking.

I can now see that it is Buffer 0 that draws lines, and how !=0 is the trigger point for a new line. As yet not sure how to NOT add trades to the same line when !=0 happens repeatedly over time when price extends that line; for a sober time for sure to work that out.

Re RVI:

I have changed the "int" to "double" to stay consistent with normal conventions about these things and will upload the revised RVI cross EA after having added the option of "CloseOnTrendChange".

Hehe, it now makes totally clear sense to me why "rvi" and "rvisig" are the values I was seeking....now that you have told them to me . Couldn't see the wood for all the trees I guess.

All good stuff!

Thanks again Mr Tools

Phil

 

Please Help me Ea codes !!!

hello friends !!!

Sidus ready in the hands of expert i, and does anyone have the full TDV with indicator!!!

When the full TDV expert Sidus up or down arrow When the green light indicator is a good signal that there is in the hands of the expert

please helpme Thank you read !!!

 

About sidus - so what I found here in elite section:

sidus_v.3.01 indicator is on this post. Extended the alerts made with all the alert possibilities (messages, sound, email, ...) and it shows exatly which chart - time frame has raised the alert now.

Just for information.

 

sidus expert+full TDV

good days.

I was with Sidus indicator indicator with the full TDV would like an expert can help you do

Reason: