StockFetcher Forums · General Discussion · Sort by days since trigger<< >>Post Follow-up
100011
2 posts
msg #158999
Ignore 100011
4/24/2022 9:09:17 PM

Hi Everyone,

I've came across some code (sorry don't remember who to give credit) and added a few basic updates. The one issue I'm trying to figure out is how to sort it by days since one of the triggers triggered. I would be nice to see in order of when Longposition or Shortposition triggered. Instead of going through the charts.

Thanks in advanced!


sp500

set{E3, ema(10) - ema(50)}

set{Longposition, count(E3 > 0,1)}
set{Shortposition, count(E3 < 0,1)}
SET{TRIGGER,0}

draw shortposition on plot trigger
draw longposition on plot trigger

add column ema(10)
add column ema(50)
add column longposition
add column shortposition


draw ema(10)
draw ema(50)
draw ma(200)

chart-time 1 year




Mactheriverrat
2,983 posts
msg #159000
Ignore Mactheriverrat
4/24/2022 10:21:40 PM

Submit
Fetcher[
sp500

set{E3, ema(10) - ema(50)}

set{Longposition, count(E3 > 0,1)}
set{Shortposition, count(E3 < 0,1)}
SET{TRIGGER,0}

draw shortposition on plot trigger
draw longposition on plot trigger

add column ema(10)
add column ema(50)
add column longposition
add column shortposition


draw ema(10)
draw ema(50)
draw ma(200)

chart-time 1 year

add column separator
add column separator

/* e10e50 is number of consecutive days EMA(13) above (+)/below(-) previous EMA(13) */
set{e10e50b,days( ema(10) is above ema(50) ,250)}
set{e10e50a,days( ema(10) is below ema(50) ,250)}
set{e10e50, e10e50a - e10e50b} and add column e10e50 {e10e50}

Set{cntema10aboveema50,count( eMA(10) > eMA(50) ,1)}
draw cntema10aboveema50

Set{cntema10aboveema50b,count( eMA(10)< EMA(50) ,1)}


draw cntema13aboveema13b

add column separator
add column separator

]



100011
2 posts
msg #159001
Ignore 100011
4/24/2022 10:47:49 PM

Yep I was not going to get that anytime soon, thank you very much for the help with this!

Mactheriverrat
2,983 posts
msg #159002
Ignore Mactheriverrat
4/25/2022 11:05:13 AM

You're Welcome.

StockFetcher Forums · General Discussion · Sort by days since trigger<< >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


Copyright 2022 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.