Counting candles
-
Hello Dreemas
I have a new project but i cant figure it out how to do with counting back candles.
There are two crossing that need to make. First the Ma 20 need cross Ma 50 after that the Ma 20 need to cross the price. From the first to the second crossing there need 10 or less candle to buy.

The picture have 12 that means sell. can some one help me with this?

The candle ID are just fixed. It cant make < then 10 candle. Are there other ways or should i do it with conditions
-
@william-1 You can do this with a loop, have a condition of your max candles and then a cross for the second, or just use 2 loops this will show you how to start:
-
thank you very much
-
@jstap I dont understand. Could you explain this?
-
@william-1 How do you mean? Use the link and generate a copy for yourself, put the variables in a comment block, then you can watch on back test to see what the loop is doing, from there you can see how to add whatever else you need to create your EA.
-
@jstap Where can i adjust the candle between 20x100 and 20x price. < 10 candle between = buy and >10 is = sell
-
@william-1 There is 2 loops in there, the first will count candles when ma20 is above ma50, the second counts candles when ma20 is below ma50, when 1 is counting the other will be at 0. The two blocks underneath you put in your buy/sell tree, change settings to suit, you can change the minimum candles in the inputs. Once you have the first set of loops doing what you require, copy, add variables and change settings, when you have enough to do all you require you have the basis of your EA.
-
@jstap I tried. But it doesnt do anything. The input was 10< candle. When the ma 20 hit the candle it will count back right? if there is less then 10 candle between MA 20 X price and MA 20 xMA 100 - buy.
Is there another way to do this like with bundling two condition into one with variable. or does variable does other thing.
Like this

But i keep having errors
-
@william-1 Put a shared link here of whar you;ve done and I'll have a look.
-
@jstap my project or your example project
-
@william-1 Your project.