MQL4 - automated forex trading   /  

Forum

guidence for next project (insert knowledge here please)

Back to topics list To post a new topic, please log in or register

avatar
53
LanBar 2010.08.10 01:58 

alright fellas....

i would like to code a ZigZag indicator that is based off of the swings of an oscillator.

for example i would like to find the highest price reached during a bullish momentum swing (momentum indicator moving from negative to positive) and then the lowest prices reached during a bearish move.

i have limited coding capabilities but i am actively trying to learn.


what i don't understand is how to establish the highs and the lows of a swing based off of another indicator...

any help would be greatly appreciated.

thanks in advance

LanBar

Method of Determining Errors in Code by Commenting

Method of Determining Errors in Code by Commenting

The article describes a method of searching the errors in the MQL4 code that is based on commenting. This method is found to be a useful one in case of problems occuring during the compilation caused by the errors in a reasonably large code.


avatar
1975
zzuegg 2010.08.10 02:21 
LanBar:


for example i would like to find the highest price reached during a bullish momentum swing (momentum indicator moving from negative to positive) and then the lowest prices reached during a bearish move.


in this sentence you have all you need:

1) identify swingpoints of the ossi

2) identify high/low during that swing

3) connect these points

1)

if(pos+1 > pos && pos-1 <pos) UpSwingStartPoint=pos, DownSwingEndPoint=pos

if(pos+1 < pos && pos-1 >pos) UpSwingEndPoint=pos, DownSwingStartPoint=pos

2)

new zigzagpoint=

a) when new upswing start Lowest(from DownSwingStartpoint to DownSwingEndPoint)

b) when new downswing start Highest(from UpSwingStartpoint to UpSwingEndPoint)

3)

connect zigzagpoints


avatar
53
LanBar 2010.08.10 04:53 

Thanks !

let me give that a shot and i will post the code i come up with.


avatar
Moderator
1935
BarrowBoy 2010.08.10 12:38 
LanBar:

alright fellas....

i would like to code a ZigZag indicator that is based off of the swings of an oscillator.


Dont want to rain on your strawberries but I'm not sure what strategy this is for

The handy things about oscillators is that successive extremes can diverge from price action as their key signal,
or when they breakback through key levels

By the time you have joined the dots with a zig-zag, it will be somewhat... late..?

Excellent that you are having a go though :)

-BB-


avatar
53
LanBar 2010.08.10 22:20 

Yes i agree BB!

unless you use an extremely short period, oscillators don't produce fast enough signals to catch the bulk of a move, and then on top of that you then have to deal with all of the false signals given by the short time frame. but my strategy uses the extremes of previous moves compared to current price actions to take positions and manage exits. but like you mentioned, the most useful information shown by occis is price divergence. this project is just the first step towards making a divergence indicator which from here seems like quite a task.

Thanks

Landon


avatar
53
LanBar 2010.08.27 01:00 

ok back to this....

i am still really confused on how to establish the the points needed to find the high or the low of a swing from occi or histogram....

could someone please post an example.

for example lets use the Momentum indicator. could someone post a zigzag based off of the swing of a momentum indicator please?


avatar
53
LanBar 2010.08.27 02:31 
bump
Back to topics list  

To add comments, please log in or register