简体   繁体   中英

Pine script - Enter position when multiple conditions are true or false

Sorry I am new to pine script. Hope you can help me on this. I am trying to add multiple conditions in to my exiting V4 script as follows.

Condition1 = crossover(close,ema1)
Condition2 = crossunder(close,ema1)
Condition3 = crossover(rsi,50)
Condition4 = crossunder(rsi,50)
How do I make the conditions status "True" or "False" for the followings scenario?
Long = (if last cross was Condition1) and Condition3
Short = (if last cross was Condition2) and Condition4

Many Thanks

Exactly as you have written in natural language.

Long = Condition1 and Condition3

And later you can trigger an alert when Long is true.

This has nothing to do with Pine, this is Boolean algebra which you should read about to understand it better: https://en.wikipedia.org/wiki/Boolean_algebra

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