Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

N57H

Add Switches to Indicator

Recommended Posts

Hi i need to add 2 switches for this indicator. One for show/no show R3 S3

and the second for R4 S4

 

I would appreciate if someone can help with this request.

 

[LegacyColorValue = true];

 

{4/28/05. DeanVan @ TS} {Thanks to eKam for use of roundInst and other pivot types I got from ChiasmLevels}

{based on intraday data (is sometimes a little different than daily data, so won't match exact)}

{idea is that it will change each day @ "NewDayTM", to reflect the next days numbers.}

{..check the open/close values to verify the day it's showing. It seems to work}

{always posting 1 bar behind, since must be NO on "update value intra-bar"}

 

input: PivotType(0),

BarsBack(60),

ShowClose(1),

ShowOpen(1),

ShowHalfPivots(1),

ShowLevel(0),

DaysBack(1),

NewDayTM(1615),

RoundLevels(false),

DecPlaces(2),

SupResType(0);

 

var: theday(0);

var: Maxcnt(11);

array:

TL[12](-1),Val[12](-1),

Color[12](6),Label[12]("L"),FTextID[12](-1), TLabel[12](" ");

 

var: cnt(0),sdate(0),stime(0),fPivot(0),twOpen(0),theRa nge(0);

 

if lastbaronchart then begin

 

if time >= NewDayTM then theday = 0 else theday = 1;

theday = theday + DaysBack-1;

if theday <= 0 then begin

theday = 0;

twOpen = 0;

end else twopen = theday-1; {make sure this weeks open isn't <0}

 

{store weekly Open and Close that we care about}

Val[10] = CloseD(theday);

if PivotType >0 and PivotType <4 then Val[11] = OpenD(twopen) else Val[11] = OpenD(theday);

 

{calculate central pivot based on pivot type}{not sure how usefull some of these might be}

if PivotType = 1 then fPivot = (HighD(theday) + LowD(theday) + Val[11]) /3

else if PivotType = 2 then fPivot = (HighD(theday) + LowD(theday) + Val[11] + Val[11]) /4

else if PivotType = 3 then fPivot = (HighD(theday) + LowD(theday) + Val[10] + Val[11]) /4

else if PivotType = 4 then fPivot = (HighD(theday) + LowD(theday) + Val[10] + Val[11]) /4

else fPivot = (HighD(theday) + LowD(theday) + Val[10]) /3; {default standard Pivot}

 

if SupResType = 1 then begin {seems like there is always a little different way to do these}

theRange = (HighD(theday) - LowD(theday))/2;

VAl[1] = fPivot;

VAl[2] = fPivot + theRange; {R1}

VAl[3] = fPivot - theRange; {S1}

 

VAl[4] = VAl[2] + theRange; {R2}

VAl[5] = VAl[3] - theRange; {S2}

 

VAl[6] = VAl[4] + theRange; {R3}

VAl[7] = VAl[5] - theRange; {S3}

VAl[8] = VAl[6] + theRange; {R4}

VAl[9] = VAl[7] - theRange; {S4}

end

else begin

VAl[1] = fPivot;

VAl[2] = fPivot + fPivot - LowD(theday); {R1}

VAl[3] = fPivot + fPivot - HighD(theday); {S1}

 

VAl[4] = fPivot + VAl[2] - VAl[3]; {R2}

VAl[5] = fPivot - VAl[2] + VAl[3]; {S2}

 

VAl[6] = fPivot + VAl[4] - VAl[3]; {R3}

VAl[7] = fPivot - VAl[4] + VAl[3]; {S3}

VAl[8] = fPivot + VAl[4] - VAl[5]; {R4}

VAl[9] = fPivot - VAl[4] + VAl[5]; {S4}

end;

 

if RoundLevels then begin

for cnt = 1 to 11 begin

val[cnt] = roundInst(val[cnt]);

end;

end;

 

Color[1] = LightGray;

Color[2] = red;

Color[3] = Darkgreen;

Color[4] = red;

Color[5] = Darkgreen;

Color[6] = red;

Color[7] = Darkgreen;

Color[8] = red;

Color[9] = Darkgreen;

Color[10] = Yellow;

Color[11] = DarkBrown;

 

TLabel[1] = "Pivot - ";

TLabel[2] = "R1 - ";

TLabel[3] = "S1 - ";

TLabel[4] = "R2 - ";

TLabel[5] = "S2 - ";

TLabel[6] = "R3 - ";

TLabel[7] = "S3 - ";

TLabel[8] = "R4 - ";

TLabel[9] = "S4 - ";

TLabel[10] = "Y:Close - ";

TLabel[11] = "Y:Open - ";

 

 

sdate = Date[barsBack];

stime = Time[barsBack];

 

 

for cnt= 1 to Maxcnt begin

if cnt < 10 or (ShowClose <> 0 and cnt = 10) or (ShowOpen <> 0 and cnt = 11) then begin

if TL[cnt] < 0 then begin {dosn't exist, create new TL}

TL[cnt] = TL_New (sdate, stime, Val[cnt],

date, time , Val[cnt]);

TL_SetColor (TL[cnt], Color[cnt]);

if cnt >= 10 then TL_SetStyle (TL[cnt], Tool_Dashed)

else TL_SetStyle (TL[cnt], Tool_Dashed);

end;

if TL_Exist(TL[cnt]) then begin {exist}

TL_SetEnd (TL[cnt], date, time , Val[cnt]);

TL_SetBegin (TL[cnt], sdate, stime, Val[cnt]); {reset TL}

end;

 

{do text stuff}

if FTextID[cnt] < 0 then begin {is new}

FTextID[cnt] = Text_New(sdate, stime, Val[cnt], "zzz");

Text_SetStyle(FTextID[cnt], 1, 2);

Text_SetColor(FTextID[cnt], Color[cnt]);

end;

if FTextID[cnt] >= 0 then begin {already exists}

Text_SetLocation(FTextID[cnt], sdate, stime, Val[cnt]);

Text_SetString(FTextID[cnt],TLabel[cnt] + NumToStr(Val[cnt], DecPlaces) + " " );

end;

end; {count < 6, etc.}

end; {cnt}

 

Array: HalfTL[9](-1),HalfVal[9](0),HTextID[9](-1);

 

if ShowHalfPivots <> 0 then begin

HalfVal[1] = ((Val[4] - Val[2])/2) + Val[2];

HalfVal[2] = ((Val[2] - Val[1])/2) + Val[1];

HalfVal[3] = ((Val[1] - Val[3])/2) + Val[3];

HalfVal[4] = ((Val[3] - Val[5])/2) + Val[5]; {s1-s2}

HalfVal[5] = ((Val[4] - Val[6])/2) + Val[6];

HalfVal[6] = ((Val[5] - Val[7])/2) + Val[7]; {s2-s3}

HalfVal[7] = ((Val[6] - Val[8])/2) + Val[8];

HalfVal[8] = ((Val[7] - Val[9])/2) + Val[9]; {s3-s4}

 

if RoundLevels then begin

for cnt = 1 to 8 begin

HalfVal[cnt] = roundInst(HalfVal[cnt]);

end;

end;

 

for cnt= 1 to 8 begin

if HalfTL[cnt] < 0 then begin {dosn't exist, create new TL}

HalfTL[cnt] = TL_New (sdate, stime, HalfVal[cnt],

date, time , HalfVal[cnt]);

TL_SetColor (HalfTL[cnt], DarkGray);

TL_SetStyle (HalfTL[cnt], Tool_Dashed);

end;

if TL_Exist(HalfTL[cnt]) then begin {exist}

TL_SetEnd (HalfTL[cnt], date, time , HalfVal[cnt]);

TL_SetBegin (HalfTL[cnt], sdate, stime, HalfVal[cnt]); {reset TL}

end;

 

{do text stuff}

if HTextID[cnt] < 0 then begin {is new}

HTextID[cnt] = Text_New(sdate, stime, HalfVal[cnt], "zzz");

Text_SetStyle(HTextID[cnt], 1, 2);

Text_SetColor(HTextID[cnt], DarkGray);

end;

if HTextID[cnt] >= 0 then begin {already exists}

Text_SetLocation(HTextID[cnt], sdate, stime, HalfVal[cnt]);

Text_SetString(HTextID[cnt], NumToStr(HalfVal[cnt], DecPlaces) + " " );

end;

end; {cnt}

end; {ShowHalfPivots}

 

end; {last bar}

 

if ShowLevel > 0 and ShowLevel <= 4 then begin

noplot(2);

noplot(3);

if ShowLevel = 1 then begin

Plot2[-1](Val[2] + .5,"h");

Plot3[-1](Val[3] - .5,"l");

end

else if ShowLevel = 2 then begin

Plot2[-1](Val[4] + .5,"h");

Plot3[-1](Val[5] - .5,"l");

end

else if ShowLevel = 3 then begin

Plot2[-1](Val[6] + .5,"h");

Plot3[-1](Val[7] - .5,"l");

end

else if ShowLevel = 4 then begin

Plot2[-1](Val[8] + .5,"h");

Plot3[-1](Val[9] - .5,"l");

end;

 

end;

Share this post


Link to post
Share on other sites
  N57H said:
Hi i need to add 2 switches for this indicator. One for show/no show R3 S3

and the second for R4 S4

 

I would appreciate if someone can help with this request.

...

 

 

if I could read your mind, I would help...

 

if you are looking for help, you need to:

 

1. supply an annotated chart, or a mock up

2. illustrate how, what, where, when, why, things are happening...

 

 

otherwise this request will sit unanswered, just like the few others currently on the board.

 

 

 

good luck.

Share this post


Link to post
Share on other sites

Right now this indicator present all 4 levels on both sides ("R" and "S")

 

Most of the stocks move between R2 TO S2 most of the time.

 

It will be good if we can have a switch in this indicator that will enable us to show R3 AND S3 and R4 and S4 (2 switches - 1 for 3 level and 1 for 4 level)

 

The problem is that when the price is between R1 to S1 and this indicator present also the 3 and 4 levels the chart looks very "squeezed". Removing these levels will make the chart looks better and not squeezed.

 

In a case that the stock is in the 3 or 4 level we can enable these levels again...

 

Thanks

Share this post


Link to post
Share on other sites

you don't need to change the code.

 

For MultiCharts:

just set the symbol to NOT include indicators in the scaling.

 

10086d1239215165-paint-town-red-pttr_1.gif

 

 

 

I believe TradeStation has similar arrangement,

TS users can post a screen shot of the set up screen.

Share this post


Link to post
Share on other sites

manipulate Maxcnt

(Like set it to (ShowLevel * 2) + 1 or use an different, equivalent input if ShowLevel has other consequences you don't want)

 

Then when

for cnt= 1 to Maxcnt begin

runs, it will only show as many as you want...

Share this post


Link to post
Share on other sites

Hi,

 

Tams helped me with the issue.

 

A question: Dr Brett Steenberger calculate the pivots in a different way. I asked him how and he sold me that it's a "proprietary secret".

 

His calculations for today are: 6:02 AM CT - $SPY targets: Pivot=102.67; R1=103.43; R2=103.68; R3=103.93; S1=101.92; S2=101.67; S3=101.42. Trading above pivot. $$

 

 

Maybe you will know how did he calculate it. It's a challenge...

 

Thanks

Share this post


Link to post
Share on other sites
  N57H said:
Hi,

 

Tams helped me with the issue.

 

A question: Dr Brett Steenberger calculate the pivots in a different way. I asked him how and he sold me that it's a "proprietary secret".

 

His calculations for today are: 6:02 AM CT - $SPY targets: Pivot=102.67; R1=103.43; R2=103.68; R3=103.93; S1=101.92; S2=101.67; S3=101.42. Trading above pivot. $$

 

 

Maybe you will know how did he calculate it. It's a challenge...

 

Thanks

 

 

 

I would leave the "proprietary secret" a secret.

If he has nothing to share then move on...

 

 

Learn to read the market; you don't need to depend on anybody else.

Everything you need to know to be profitable is already posted in TradersLaboratory.

Edited by Tams

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Topics

  • Posts

    • AMZN Amazon stock, nice buying at the 187.26 triple+ support area at https://stockconsultant.com/?AMZN
    • DELL Dell Technologies stock, good day moving higher off the 90.99 double support area, from Stocks to Watch at https://stockconsultant.com/?DELL
    • MCK Mckesson stock, nice trend and continuation breakout at https://stockconsultant.com/?MCK
    • lmfx just officially launched their own LMGX token, Im planning to grab a couple of hundred and maybe have the option to stake them. 
    • Date: 2nd April 2025.   Market on Edge: Tariff Announcement and Volatility Ahead!   The US economic and employment data continues to deteriorate with the job vacancies figures dropping to a 5-month low. In addition to this, the IMS Manufacturing PMI also fell below expectations. However, both the US Dollar and Gold declined simultaneously following the release of the two figures, an uncommon occurrence in the market. Traders expect a key factor to be today’s ‘liberation day’ where the US will impose tariffs on imports. USDJPY - Traders Await Tariff Confirmation! Traders looking to determine how the USDJPY will look today will find it difficult to determine until the US confirms its tariff plan. Today is the day when Trump previously stated he would finalize and announce his tariff plan. The administration has not yet released the policy, but investors expect it to be the most expansionary in a century. President Trump is due to speak at 20:00 GMT. On HFM's Calendar the speech is stated as "US Liberation Day Tariff Announcement". Currently, analysts are expecting Trump’s Tariff Plan to impose tariffs on the EU, chips and pharmaceuticals later today as well as reciprocal tariffs. Economists have a good idea of how these tariffs may take effect, but reciprocal tariffs are still unspecified. In addition to this, 25% tariffs on the car industry will start tomorrow. The tariffs on the foreign cars industry are a factor which will particularly impact Japan. Although, traders should note that this is what is expected and is not yet finalised. Last week, President Trump stated that he would implement retaliatory tariffs but allow exemptions for certain US trade partners. Treasury Secretary Mr Bessent and National Economic Council Director Mr Hassett suggested that the restrictions would primarily target 15 countries responsible for the bulk of the US trade deficit. However, yesterday, Trump contradicted these statements, asserting that additional duties would be imposed on any country that has implemented similar measures against US products. The day’s volatility will depend on which route the US administration takes. The harshness of the policy will influence both the Japanese Yen as well as the US Dollar.   USDJPY 5-Minute Chart   US Economic and Employment Data The JOLT Job Vacancies figure fell below expectations and is lower than the previous month’s figure. The JOLT Job Vacancies read 7.57 million whereas the average of the past 6 months is 7.78 million. The ISM Manufacturing Index also fell below the key level of 50.00 and was 5 points lower than what analysts were expecting. The data is negative for the US Dollar, particularly as the latest release applies more pressure on the Federal Reserve to cut interest rates. However, this is unlikely to happen if the trade policy ignites higher and stickier inflation. In the Bank of Japan’s Governor's latest speech, Mr Ueda said that the tariffs are likely to trigger higher inflation. USDJPY Technical Analysis Currently, the Japanese Yen Index is the worst performing of the day while the US Dollar Index is more or less unchanged. However, this is something traders will continue to monitor as the EU session starts. In the 2-hour timeframe, the USDJPY is trading at the neutral level below the 75-bar EMA and 100-bar SMA. The RSI and MACD is also at the neutral level meaning traders should be open to price movements in either direction. On the smaller timeframes, such as the 5-minute timeframe, there is a slight bias towards a bullish outcome. However, this is only likely if the latest bearish swing does not drop below the 200-Bar SMA.     The key resistant level can be seen at 150.262 and the support level at 149.115. Breakout levels are at 149.988 and 149.674. Key Takeaway Points: Job vacancies hit a five-month low, and the ISM Manufacturing PMI missed expectations, adding pressure on the Federal Reserve regarding interest rate decisions. Traders await confirmation on Trump’s tariff policy, which is expected to impact the EU, chips, pharmaceuticals, and foreign car industries. The severity of the tariffs will influence both the JPY and the USD, with traders waiting for final policy details. The Japanese Yen Index is the worst index of the day while the US Dollar Index is unchanged. Always trade with strict risk management. Your capital is the single most important aspect of your trading business.   Please note that times displayed based on local time zone and are from time of writing this report.   Click HERE to access the full HFM Economic calendar.   Want to learn to trade and analyse the markets? Join our webinars and get analysis and trading ideas combined with better understanding of how markets work. Click HERE to register for FREE!   Click HERE to READ more Market news.   Michalis Efthymiou HFMarkets   Disclaimer: This material is provided as a general marketing communication for information purposes only and does not constitute an independent investment research. Nothing in this communication contains, or should be considered as containing, an investment advice or an investment recommendation or a solicitation for the purpose of buying or selling of any financial instrument. All information provided is gathered from reputable sources and any information containing an indication of past performance is not a guarantee or reliable indicator of future performance. Users acknowledge that any investment in Leveraged Products is characterized by a certain degree of uncertainty and that any investment of this nature involves a high level of risk for which the users are solely responsible and liable. We assume no liability for any loss arising from any investment made based on the information provided in this communication. This communication must not be reproduced or further distributed without our prior written permission.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.