NexusFi: Find Your Edge


Home Menu

 





How to detect condition in the last few current minutes?


Discussion in ThinkOrSwim

Updated
    1. trending_up 2,093 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 1 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
Artfldgr
New York + New York / USA
 
Posts: 76 since Jan 2020
Thanks Given: 2
Thanks Received: 91

This has been driving me nuts for a short while...
[and i am a professional programmer of more common languages like Java]

Its really a general question about how to only detect a condition, like crossover within the last few minutes, and ignore crossovers that occurred earlier in the time period.

To make this clear... lets say your looking at a 1 min chart, and its the afternoon..
and your running a plot like this

def ema1 = ExpAverage(close, 8);
def ema2 = ExpAverage(close, 88);
def emaCrossingAbove = ema1[1] < ema2[1] and ema1 > ema2;
plot aaa = ema1;
plot bbb = ema2;
plot scan = emaCrossingAbove;
scan.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);

And it works ok... it detects the crossover above, and indicates with an arrow
and you can use it in a scan (of course)

however, and here is the real dig... you dont care if there were three crossovers in the morning
you only want to know if one has occurred within the past 5 minutes (or some period of time) from current moment

similarly... you have two averages.
def ema1 = ExpAverage(close, 8);
def ema2 = ExpAverage(close, 88);

and you want to indicate with an arrow if their distance apart is a certain amount
call it an almost cross over...
and of course, like above, you dont care if they almost crossed over (to the dark side?) earlier in time

These two things been driving me nuts to implement..
as the 2nd one can help detect a widening average, or converging average..

however the question of event in time or past x time, can help a whole lot in a lot of ways...

any takers?


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Kalshi Sets $4.13B All-Time Weekly Record as Polymarket …
Prediction Markets & Event Contracts
Thursday May 28: GDP + Core PCE + Jobless Claims All at …
Traders Hideout
Hormuz Normalization Collapses to 19.5% -- Iran Regime F …
Prediction Markets & Event Contracts
Peace Deal Forward Curve: May 22%, June 51%, December 81 …
Prediction Markets & Event Contracts
Iran Peace Expired NO: Ceasefire on Life Support, OPEC a …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
15 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 thanks
  #2 (permalink)
DaveDoggyDogg
Los Angeles,CA USA
 
Posts: 16 since Mar 2017
Thanks Given: 0
Thanks Received: 7


Artfldgr View Post
This has been driving me nuts for a short while...
[and i am a professional programmer of more common languages like Java]

Its really a general question about how to only detect a condition, like crossover within the last few minutes, and ignore crossovers that occurred earlier in the time period.

To make this clear... lets say your looking at a 1 min chart, and its the afternoon..
and your running a plot like this

def ema1 = ExpAverage(close, 8);
def ema2 = ExpAverage(close, 88);
def emaCrossingAbove = ema1[1] < ema2[1] and ema1 > ema2;
plot aaa = ema1;
plot bbb = ema2;
plot scan = emaCrossingAbove;
scan.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);

And it works ok... it detects the crossover above, and indicates with an arrow
and you can use it in a scan (of course)

however, and here is the real dig... you dont care if there were three crossovers in the morning
you only want to know if one has occurred within the past 5 minutes (or some period of time) from current moment

similarly... you have two averages.
def ema1 = ExpAverage(close, 8);
def ema2 = ExpAverage(close, 88);

and you want to indicate with an arrow if their distance apart is a certain amount
call it an almost cross over...
and of course, like above, you dont care if they almost crossed over (to the dark side?) earlier in time

These two things been driving me nuts to implement..
as the 2nd one can help detect a widening average, or converging average..

however the question of event in time or past x time, can help a whole lot in a lot of ways...

any takers?


the following code is defining the last 10 bars, and since its set to 1 Minute, 1x10=10

therefor the scan will scan the last 10 minutes of 1 minute bars for crossings of the 8ma over the 88

 
Code
MovAvgExponential("length" = 8)."AvgExp" crosses above MovAvgExponential("length" = 88)."AvgExp" within 10 bars


Reply With Quote




Last Updated on March 5, 2020


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts