Ceiling line not working with minimum
Forums › ProRealTime English forum › ProBuilder support › Ceiling line not working with minimum
- This topic has 3 replies, 3 voices, and was last updated 3 years ago by robertogozzi.
-
-
02/24/2021 at 11:36 PM #162558
Hi,
Let’s take an ema and compare current value with its previous value.
As long as it goes down, slode negative, we draw a ceiling on top of price with highest high of last 20 bars.
123456789ema = Average[20](close)IF ema < ema[1] THENceils = Highest[20](high)ELSEceils = ceils[1]ENDIFReturn ceilsResult in attached file.
It looks great until the slope turns positive for a few candles, and then negative again, whereas during these few candles the highhest high over the 20 last high has increased.
The orange line turns blue. But I don’t want the ceiling value to increase.
So I decide, when the slope is negative, to draw as ceiling the minimum value beetween the previous ceilling and the highest high.
123456789ema = Average[20](close)IF ema < ema[1] THENceils = Min(ceils[1], Highest[20](high))ELSEceils = ceils[1]ENDIFReturn ceilsWhen I validate the indicator, no ceiling line is drawn on the chart.
I don’t undestrand why …
I tried to initialise with a high value, and/or use a temporary variable to calculate the min …
123456789101112ema = Average[20](close)once ceils = 1000000000000000IF ema < ema[1] THENk = Min(ceils[1], Highest[20](high))ceils = kELSEceils = ceils[1]ENDIFReturn ceilsCeiling line still not drawn on chart 🙂
Any idea why ?
Thks.
gfx
02/25/2021 at 12:22 AM #162570gfx – Once again this is an indicator coding question and not a platform issue. That is the second one tonight posted in the wrong place. Please try to understand which forums are for which subjects. I moved your topic….again.
Post your topic in the correct forum:
_ ProRealTime Platform Support: only platform related issues.
_ ProOrder: only strategy topics.
_ ProBuilder: only indicator topics.
_ ProScreener: only screener topics
_ General Discussion: any other topics.
_ Welcome New Members: for new forum members to introduce themselves.02/25/2021 at 12:27 AM #16257102/25/2021 at 12:29 AM #162572In the first two examples, lines 5 and 6 can be removed.
Example 1 works fine. Please post instrument, TF, date and time of the candle where it plots incorrectly.
If you replace your second example with this one, it’lll work, but due to MIN() the indicator is quite BELOW the current price so you’ll have to shrink the chart slightly (and use 10K units):
12345678IF BarIndex > 20 thenema = Average[20](close)once ceils = Highest[20](high)IF ema < ema[1] THENceils = Min(ceils, Highest[20](high))ENDIFendifReturn ceilsThird example is like the second one:
1234567891011if barindex > 20 thenema = Average[20](close)once ceils = Highest[20](high)//1000000000000000IF ema < ema[1] THENk = Min(ceils, Highest[20](high))ceils = kendifendifReturn ceils -
AuthorPosts
Find exclusive trading pro-tools on