# High/Low of the bar previous to the signal bar

#### rook

##### Member
Really appreciate if someone can show how to refer high/low of the bar previous to signal bar - with no applystop function.
This can help in calculating position size automatically through afl and could display on screen.
Any help is highly appreciated. Thanks.

#### Romeo1998

##### Active Member
Dear friend,
I think this is what u r looking for
Code:
``````//plotting price
Plot( C,"",colorDefault,styleCandle);

Buy = Cross( MACD(), Signal() );

//plot a green arrow below the candle on chart when condition is true

//referring to the previous bar before the condition

//plot a yellow arrow below that candle

//referring to the previous bar's high before the condition

//referring to the previous bar's low before the condition

//plotting those highs and lows
Plot(hh,"",colorBlue,styleLine|styleDots);
Plot(ll,"",colorViolet,styleLine|styleDots);``````

Last edited:

#### rook

##### Member
Many thanks!!
However, can you explain how Ref(Buy,1) refers to the previous bar? Would it not look for the bar after the Buy Signal?

Dear friend,
I think this is what u r looking for
Code:
``````//plotting price
Plot( C,"",colorDefault,styleCandle);

Buy = Cross( MACD(), Signal() );

//plot a green arrow below the candle on chart when condition is true

//referring to the previous bar before the condition

//plot a yellow arrow below that candle

//referring to the previous bar's high before the condition

//referring to the previous bar's low before the condition

//plotting those highs and lows
Plot(hh,"",colorBlue,styleLine|styleDots);
Plot(ll,"",colorViolet,styleLine|styleDots);``````

#### Romeo1998

##### Active Member
I am searching in the help file

Last edited:

#### Romeo1998

##### Active Member
yes u r right friend,
but when i used ref(buy,-1), the arrow was shown after the condition bar
so then i used ref(buy,1) n then it was shown before the condition bar
i have no idea how this worked

#### rook

##### Member
I will get back after some experimentation to understand how it works.

##### Active Member
yes u r right friend,
but when i used ref(buy,-1), the arrow was shown after the condition bar
so then i used ref(buy,1) n then it was shown before the condition bar
i have no idea how this worked
sir can u code afl strategy