♥ 0 |
Hello! I am trying to write a code which scans for the price crossing/hitting a particular moving average atleast twice within the past 4 bars. I coded the crossing/hitting portion to where the price is within a certain percentage of the MA. However I cannot correctly code the price crossing/hitting the MA atleast twice within the past 4 bars. As of now it is coded to where two consecutive bars hit the respective MA. The code runs and the majority of tickers follow the code, however there are some which don’t which has made me question if the code is correct. Here is what I have so far. def ma = SimpleMovingAvg(close,50); def s = ma*0.002; def consecutive = absvalue(close – ma) is less than or equal to s; def x = consecutive[1] and consecutive; plot scan = x; Thank you!!!! Sincearly: Someone who can’t code
Marked as spam
|
Please log in to post questions.