Lastvalue(buy) always 0

Dear all,

@Tomasz @fxshrat
I have gone through many many posts but still could not figure out a solution, so finally I have decided to seek help.

I want to send an automated order based on:

If (lastvalue(Buy)) { send order....}

I tried to explore and find out why orders are not triggered. I saw that although the BUY array is 1 at places, lastvalue (Buy) never turns 1. I even tried if ( LastValue( Ref(Buy,-1) ) cause one of the users said that Lastvalue is a forward looking function.

image

Any ideas?

No, it depends on how it is used. It may be and may not be forward looking if using LastValue() function.


If you get LastValue(Buy) being zero then there simply is no TRUE signal on last bar. It just returns the state being there. It does not invent new states. Besides your buy rule is unknown and your picture of sample result list is not telling much.

1 Like

Thanks @fxshrat sir for your explanations. Unfortunately can not share the afl, cause most of the code is referring to a locked dll so will not help.

Another way of troubleshooting this is:: if I get all the bars in the exploration.

How to force the exploration to list out all the rows? All the 5-mins bars. Currently it is skipping so many bars...

image

it is done but not Filtering anything in exploration.

Filter = 1;

Thank you @nsm51 @fxshrat I was able to resolve it using full exploration by setting Filter=1;

Strangely, Lastvalue (Buy) is still 0 for all the 5-min bars despite having Buy=1 in so many bars.

I used another signal which turns 1 when price touches the upper band, this solved the purpose.