Entering trade on same bar as condition check
Posted: Wed Apr 05, 2023 3:54 pm
Good morning. I have a strategy that I am working on for a 5minute chart timeframe and I would like to enter the on the same unconfirmed bar that I am checking conditions on. Not sure if pinescript will allow entering on the same bar as conditions or not
I am trying to do something like this:
Did the low of the current bar drop below the close of the prior candle by 50 cents?
If yes, then did the high of the current bar exceed the high of the prior bar?
If yes to both enter long immediately on same candle.
I am trying to code it
PriceActionFilter=false
if low < close[0]-.5 //Did price of the current unconfirmed bar drop at least 50 cents below the close of the prior bar?
if high > high[0]+.1 //if yes to above, did price of the current unconfirmed bar exceed the high of the prior bar by 20 cents?
PriceActionFilter :=true //if yes to both above conditions, make my price action filter true.
Not sure if I am referencing the low and high of the current bar correctly in the code above and the larger question is can I enter on the same bar assuming the PriceActionFilter is satisfied or true?
Thanks for you help.
I am trying to do something like this:
Did the low of the current bar drop below the close of the prior candle by 50 cents?
If yes, then did the high of the current bar exceed the high of the prior bar?
If yes to both enter long immediately on same candle.
I am trying to code it
PriceActionFilter=false
if low < close[0]-.5 //Did price of the current unconfirmed bar drop at least 50 cents below the close of the prior bar?
if high > high[0]+.1 //if yes to above, did price of the current unconfirmed bar exceed the high of the prior bar by 20 cents?
PriceActionFilter :=true //if yes to both above conditions, make my price action filter true.
Not sure if I am referencing the low and high of the current bar correctly in the code above and the larger question is can I enter on the same bar assuming the PriceActionFilter is satisfied or true?
Thanks for you help.