Baby Steps
-
Hi
So Ive come to realise I need to baby step my way in to fxdreeam and ask for help every step of the way. Ive tested a strategy in Open Office and would like to make an EA
First of all. It divides Low price by the High Price and then takes that to the power of 20
How would I go about doing that?
Thanks and regards /Bo
-
That's interesting strategy, power of 20...
This is one way to do it:

https://fxdreema.com/shared/6KnVT6Zke -
Hi. Awesome. Thanks so much

This is the first part of a strategy/indicator. Theres is one more formula but I thought Id start with this
The idea is to indicate when there is market is in consolidation. I figured the proportion in Low/High Price would be a good way
How do I get this in a separate indicator window?
Regards /Bo
-
I'm afraid I can't help with the separate window, I guess you need some custom indicator coding there..
I have just used the comment-block to view my formulas - the downside is that you see only the latest calculation. -
for consolidation use Bollinger Band Squeeze indicator ... green dots is trend, red dots is consolidation

-
Thanks Miro
I understand what youre saying. But I have a slightly different end goal in mind. Im looking to produce a curve that has a high value at consolidation. And a low for the opposite. And then base an EA on that
The Bollinger Bands are derived from a Close Price Standard Deviation and values can vary a lot. Whereas comparing High and Low Prices seems to be a bit more stable and better for what I had in mind
Regards /Bo
-
0_1525388901672_miro1360_test_1.0.mq4
here is simple custom indicator with separate window, start from that, later you can use it in EA ... you can understand it easily, it is very simple ...

-
Duuude... Thats brilliant
How did you do that?
/Regards
-
just few lines of code in metaeditor ...
this is your computation logic in code, which you described above
for loop goes through candle IDs (but only once, barsToCalculate is my own function to speed up indicator and not recalculate all bars in history when barsLimit is set to 0 ... (it calculate history bars only once and than calculate only current candle) ... when you use it in EA, set input parameter barsLimit to some reasonable number, like 10 --- only 10 bars will be calculated) ..

-
Excellent and a big thanks for the code. From what little coding I know - 9t looks really elegant

This High/Low comparison is the first block of a four part thing.
Second part is an Weighted Average of the High/Low results. Third part is a formula for adapting the results to control other indicators. And lastly hooking that up that to the indicators and test wether its working as I intended
Can I use the regular WMA code with your code?
Regards /Bo
-
second part still simple

0_1525631996117_miro1360_test_1.0.mq4

not much changed... note that it can be done better ... but we are not going to create graphics for games so you can do code as you want, here it does not matter ...

third+last part I think can be Condition blocks in fxdreema (you can import this indicator into My Indicators, and compare results with other indicators) ...
-
Awesome Miro
Thanks a million for this. Im hard at work on this now

Regards /Bo
-
Hello Miro
This formula didnt go fully to plan. It only worked at the 1 Minute Time Frame. So it needs some additions. I thought Id start with making a High/Low Percentage to Close Price. So essentially High divided by Low. Then the sum of that divided by Close. And then times 100 for a percentage sum.
What do I need to add to make a formula lie that work?
Thanks /Bo
int i;
for(i=barsToCalculate();i>=0;i--)
{
double priceHigh = iHigh(Symbol(), Period(), i);
double priceLow = iLow(Symbol(), Period(), i);
double lowHigh;if(priceHigh != 0) { lowHigh = priceLow / priceHigh; Buffer0[i] = MathPow(lowHigh, 20); } else { Buffer0[i] = 0; }}
for(i=barsToCalculate2();i>=0;i--)
{
Buffer1[i] = iMAOnArray(Buffer0, 0, maPeriod, 0, (ENUM_MA_METHOD)maMode, i);
} -
how the formula looks like exactly? can you type it in format similiar to this?
((A / B) + ((A + B) / C)) * 100
A = High
B = Low
C = Close
and so on ... -
Hello Miro
In Excel - it would look like this. =((A/B)/C)*100
And then a Weighted Average on that sum
Thanks
/Bo -
-
Awesome. Thanks Miro
I got it to work as intended.
Not quite as I expected but thats why Im testing things
Back to the drawing board/Bo
-
yes, that is what forex teach you .... 99.9% of fails and 0.1% of small success

-
Yep
But Im having fun so Im gonna keep going

/Bo
-
Hello Miro
Im considering adding a Simple Moving Average to the same window. Im guessing this is the code for the existing Weighted one?
Buffer1[i] = iMAOnArray(Buffer0, 0, maPeriod, 0, (ENUM_MA_METHOD)maMode, i);
How would I modify it for A Simple MA? Also? Im presuming that I need to change other code as well? βplot bufferβ....?
Thanks and regards /Bo

