michalw
Pine Script Rookie
Pine Script Rookie
Posts: 2
Joined: January 15th, 2023

mark only one bar when condition occurs

I would like to mark (ultimately enter the position)
if the condition is met (EMA intersection) and the first bar after the condition occurs and after the fulfillment of additional conditions (on the screenshot - above the price level).
If the next EMA intersection occurs - then again we consider only the first bar after the + condition above the price level.
I can't write it with an "if" construct.
He always only receives a bar when both conditions are met - that is, when the EMAs cross and if the bar is above the price - and that's not what I mean.
Can someone help me write this?

screenshot
https://im.ge/i/sUD8rz

Steve Burman
Moderator
Moderator
Posts: 109
Joined: January 13th, 2023

Re: mark only one bar when condition occurs

Can you pls send me the code for both conditions? I'll check it out

Return to “Pine Script Q&A”