仕事が完了した
指定
I need to be able to integrate this code as a function into an EA I am working on and which will function in MT4. For that, I need be able to to easily extract the values from this indicator/function.
Note: the code should be well explained, with commentaries inserted at every step to allow me to follow and verify the logic.
Phase 1 calculation and storing of ZZ High and Lows:
The information concerning the prices and the candles of the previous Zig Zags, as well as the current Extremum 0, should be stored.
The information should be stored in arrays like this:
Prices of the Zig Zag points:
ZigZagHighCandlesArray[Price1,Price2,Price3,etc.]
ZigZagLowCandlesArray[Price1,Price2,Price3,etc.]
Candles of the ZigZag points:
ZigZagHighPricesArray[CandleOfZigZagHigh1, CandleOfZigZagHigh2, CandleOfZigZagHigh3,etc.]
ZigZagLowPricesArray[CandleOfZigZagLow1, CandleOfZigZagLow2, CandleOfZigZagLow3,etc.]
Note: current candle is 0, the past candle is 1, etc.
Current Extremum 0 (which is the one that repaints) will not be placed into these arrays (until Extremum0 becomes an actual ZZ Swing point and then the value goes into the array at position 0), but will be retained into a variable of its own.
The calculations should be done On Init for the past history and then once per candle/timeframe of my choice.
Notes:
Graphical display: I need to have an easy way in the code to choose to display the indicator on the chart or not, so that I can turn it off and just get the result of the calculations (by printing them in the journal).
I need to be able to modify in the code the values of the ZZ (depth,deviation, backstep), as well as the timeframes it applies to.
The values in the arrays will be printed in the journal in an easy-to-understand way at each new candle, so that I can verify.
Phase 2: Fibonacci retracements based on ZZ
In phase 2, I need the code to calculate the FIBO retracement levels between the ZZ High and ZZ Lows and store them into 2 arrays.
One array should store the values of FIBO retracement of which the final point of the retracement is a ZZ High, and the other array should store the FIBO retracement levels of which the final point of the retracement is a ZZ Low.
So the arrays should look like this:
RetracementsToZigZagHighAsFinalPoint[23,38,44,120,etc] (the values inside are the % resulted from the calculation).
RetracementsToZigZagLowAsFinalPoint[12,140,66,120,etc]
The current retracement level between the Last ZigZags of which the final point is Extremum 0 should be stored into a separate variable of its own (until Extremum0 becomes an actual ZZ Swing point and then the value goes into the array at position 0).
The calculations should be done On Init for the past history and then once per candle/timeframe of my choice.
The values in the arrays will be printed in the journal in an easy-to-understand way at each new candle, so that I can verify.