| / | Forum |
|
shinobi111
2010.02.09 18:51
Hi guys, I'm quite new to this format of coding, but would obviously like to learn more. I've started with a simple EA, using the ZigZag indicator, but I'm struggling to make sense of the whole thing . . . The only thing that I'm after, is to report back the last 4 turn signals of the ZigZag indicator, but even that seems to be a mission at the moment. If anybody can offer some advice, or code examples, it would be greatly appreciated!!!! I started with this using the ordinary ZigZag.mp4 //Input Parameters //Vars double ZigZagValue[]; ... int start() int i = 0; //Set Arrays //Get Indicator Values //Calculate Directions (UP, DOWN, EVEN) //Debug } Here i just basically used the external indicator with the iCustom function to get the last 4 points. My Problem here was I found that although it returned the points correctly, there were rather large gaps between the times that the data was returned. It almost looks like the start function only "ticks" when the "last" point has been "fixed" if you will? Also, i'm under the impression that the very last point returned is actually not fixed, but dynamic, and is still being moved around as the loop runs. This returns incosistant data, as I cant keep the previous last 4 point saved, but one is actually replaced by the temporary point. After pulling out all my hair, I tried using the indicator ZigZag_Channels.mq4. I edited that indicator, to instead of drawing channel lines, keep a buffer with the last "know" points, both high, and low like this : In the EA : //Vars double Point1, Point2, Point3, Point4, Point5 = 0;
...
int start() //Get Indicator Values } In the Indicator, added new buffers, and replaced the DrawTrends() function with this : void DrawTrends() } I know the indexing of the lines in the EA is a bit strange, but I was still testing . . . The problem here was the same as before. The "tick" didn't seem like it actually occured on every market tick, but rather every time the indicator had new values. . . . . I dont know, think I'm a bit lost honestly!!!!!!! My question again : Can anybody show me, like when an EA runs, how you can get the last 4 points of a ZigZag, at any given moment? Any help would be greatly appreciated !!!!! Arrie. |
|
Metalanguage of Graphical Lines-Requests. Trading and Qualified Trading Learning The article describes a simple, accessible language of graphical trading requests compatible with traditional technical analysis. The attached Gterminal is a half-automated Expert Advisor using in trading results of graphical analysis. Better used for self-education and training of beginning traders. |
|
Ruptor
2010.02.09 21:38
Look at ZZ[1 to 4] instead of ZZ[0 to 3] because as you say the last point is not fixed until the candle closes. Also you need to remember with the this indicator the last point may still change on the new candle until the latest candle is either the lowest or highest of the series. I don't see how you can know that the last point of the zigzag is the last one until the trend has ended and you only know that many candles after the point is fixed.
|
|
shinobi111
2010.02.09 23:24
Thanks for the reply Ruptor!! Agreed, the last point might change yes, but with the way the code is now, somehow I'm still not getting the previous 4 points. What happens is, that ZigZag indicator actually reports back the dynamic point, which pushes out my last lets say low point value, then the indicator decides that was not the actual point, and removes it again, shifting my array of values back again . . . So tracing lets say the trend between the points in the same minute . . . would give me something like (just test data) : UP - DOWN - UP UP - DOWN - UP DOWN - UP DOWN (here the dynamic point came into play) UP - DOWN - UP UP - DOWN - UP DOWN - UP - DOWN (here the dynamic point came into play) Thats the one problem yes, can you shed any light on my question of the actual "ticks" of the expert advisor as per my post above? |