简体   繁体   中英

How to create an alert after 3 confirmations in Pinescript

Cross shapes means to sell

Hi all, I have created an indicator, but I'm stuck on how I can create a buy/sell alert after 3 orange cross. Can someone help me with the condition? Thank you!

long = longCondition1 and ta.barssince(longCondition1) < 2 and ta.barssince(longCondition1) < 3
plotshape(long, location=location.belowbar, style=shape.cross, size=size.tiny, color=color.rgb(255,192,203))

I used it but it's not following the condition that it should be plotted after 3 orange cross.

If you want to create an alert after three orange crosses in a row, you can do it as follows:

long = longCondition1 and longCondition1[1] and longCondition1[2]

If you want just the first three then your code should look like this:

long = longCondition1 and longCondition1[1] and longCondition1[2] and not longCondition1[3]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM