Afl code to get current day constant value


#1

By using loop i want to calculate current day constant high value and current day constant low value??


Using ref function
#2

@sandeep.sd9, We have no way of knowing how to help you.

We can guess, but it is a waste of our time.

Please, Tell us more.

Things like:
Timeframe: for the Database you are using (Tick, Minutes, End of Day)
Is this a Charting Issue, or an Exploration issue.

As you learn more about AmiBroker, you (hopefully) will find that you RARELY EVER NEED a LOOP.

And Best of all, show us your code, and tell us what it is not doing that you expect it to do.

Armed with the above information, we can usually provide some guidance.


#3

@snoopy.pa30's comments are particularly relevant because you have asked this exact same question before, and both @awilson and I provided you with responses. You're not likely to get a better answer without more details.


#4

i want to get sell call if any candle close below the current day low value and i want buy call if any candle close above the current day high value but the current day high and low are not constant then
how can i achieve this

Thanks in adavance


#5

Perhaps something like this UNTESTED snippet? Once again, no looping needed, we just need to compare the current bar's high/low to the highest/lowest price as of the PREVIOUS bar.

isStartOfDay = Day() != Ref(Day(),-1);
Buy = H > Ref(HighestSince(isStartOfDay,H), -1);
Sell = L < Ref(LowestSince(isStartOfDay,L), -1);

#6

@mradtke thanks for sharing code snipplet is is helpful


#7

@mradtke
loop is required because i have one more condition i.e
for example if first buy call is generated then in between there should not be any buy call
there should be sell call
means there should not be duplicates buy and sell call
thanks for ur help


#8

@mradtke
this is the pictorial diagram exactly what i want to dobuy sell diagram


#9

i want to take first buycall and first sell call from the code you gave plz help..


#10

I think the the ExRem() function will do what you want. Have you studied that?


#11

@mradtke
code snipplet for this if any candle close above previous day high and current day high then buy call should come
if any candle close below previous day low and current day low then sell call should come

plz help cant achive by using above code snipplet
Thanks in advance


#12

Thanks my problem is solved
can u provide me your mail id ?