NexusFi: Find Your Edge


Home Menu

 





FAANG Percent Change Each Session


Discussion in ThinkOrSwim

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




 
Search this Thread

FAANG Percent Change Each Session

  #1 (permalink)
 johnnymustard 
Las Vegas, NV
 
Experience: Intermediate
Platform: NT 8
Broker: NT Brokerage, IQFeed
Trading: ES, 6E & CL
Posts: 87 since Aug 2013
Thanks Given: 9
Thanks Received: 43

Hello, I've got the basics but I do need some help. I'm looking to have a percent change of the FAANG stocks per session on the left axis but I'm having 2 major issues. The code I have and a pic is below. I use the FAANG 'index' as an indicator to trade /ES on the right axis.

1) My percent change doesn't begin at 0% each session. Shouldn't it? How can I get it to begin
at 0% each session? It also doesn't begin at 0% for the first session on the chart or if I use
just today.

2) My indicator has unexplained breaks in it. Oddly enough usually around 10am PST. Obviously
my knowledge of using IsNan is limited. I don't understand it though. If I look at any of these
stocks individually, there won't be a gap. When I plot them together however, gaps are a
given. The pic below shows 10am gaps everyday this week.

I thank you in advance for any advice or guidance, JM


input AnchorDate = 20230523;
input AnchorTime = 0631;

input F = "Meta";
input A = "Amzn";
input A2 = "Aapl";
input N = "Nflx";
input G = "Goog";

def PostAnchorDate = if GetYYYYMMDD() >= AnchorDate then 1 else 0;
def PostAnchorTime = if SecondsFromTime(AnchorTime) >= 0 then 1 else 0;


def Fin = if PostAnchorDate and PostAnchorTime then (hl2(F) + hl2(A) + hl2(A2) + hl2(N) + hl2(G)) else 0;
plot FinPctChg = ((Fin - Fin[631]) / Fin[631]) * 100;
plot Zero = 0;

Attached Thumbnails
Click image for larger version

Name:	ToS_PctChg.jpg
Views:	68
Size:	225.6 KB
ID:	333544  
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
How to apply profiles
Traders Hideout
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
MC PL editor upgrade
MultiCharts
 
  #2 (permalink)
badiboy
BIRMINGHAM
 
Posts: 7 since Oct 2020
Thanks Given: 4
Thanks Received: 2

Interesting concept/thought. please see if below code will help you

few notes
- referencing Fin[631] gives you value of it 631 bars before current bar, not the one at 631
- thinkscript expects you to use market time/eastern time , so I changed time to 0930
- the gaps showing are when one of the prices is not present




## this script helps get the open price as defined by openTime and symbol
script openPriceScript {
input openTime = 0930;
input symbol = "META";
def openPrice = if SecondsFromTime(openTime) == 0 and SecondsTillTime(openTime) == 0
then HL2(symbol=symbol) else openPrice[1];
plot op = openPrice ;
}


input AnchorTime = 0930;

input F = "Meta";
input A = "Amzn";
input A2 = "Aapl";
input N = "Nflx";
input G = "Goog";

## get openingPrices at day open
def openPrice_F = openPriceScript(openTime = AnchorTime, symbol = F)."op";
def openPrice_A = openPriceScript(openTime = AnchorTime, symbol = A)."op";
def openPrice_A2 = openPriceScript(openTime = AnchorTime, symbol = A2)."op";
def openPrice_N = openPriceScript(openTime = AnchorTime, symbol = N)."op";
def openPrice_G = openPriceScript(openTime = AnchorTime, symbol = G)."op";

def openPriceSum = openPrice_F + openPrice_A + openPrice_A2 + openPrice_N + openPrice_G;

def currentPrice_F = HL2(symbol=F);
def currentPrice_A = HL2(symbol=A);
def currentPrice_A2 = Hl2(symbol=A2);
def currentPrice_N = HL2(symbol=N);
def currentPrice_G = HL2(symbol=G);

def currentPriceSum = currentPrice_F + currentPrice_A + currentPrice_A2 + currentPrice_N + currentPrice_G;

plot percentChangeForSession = ((currentPriceSum - openPriceSum) / openPriceSum)*100.0;

Reply With Quote
  #3 (permalink)
 johnnymustard 
Las Vegas, NV
 
Experience: Intermediate
Platform: NT 8
Broker: NT Brokerage, IQFeed
Trading: ES, 6E & CL
Posts: 87 since Aug 2013
Thanks Given: 9
Thanks Received: 43


Thank you, I'll take a close look.
I appreciate you taking the time.

Started this thread Reply With Quote




Last Updated on July 24, 2023


© 2024 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 - Privacy Policy - Downloads - Top
no new posts