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.

aaa

Stochastic Divergence TrendLine

Recommended Posts

// Sto Divergence TrendLine

// Author: MARKPLEX

// version: 1.0

 

// Author: aaa

// version: 2.0

// Date: 20091129

// added:

// divergence on top +

// Line.Color.Top + Line.Color.Bot + Line.Size + Plot.Sto in inputs

 

From

 

http://markplex.com/tutorial4.php

 

--------------------------------------------------------

 

attachment.php?attachmentid=16297&stc=1&d=1260006509

Snap1.jpg.0587c4123cb5defef4ed242367a7e6ef.jpg

Sto Divergence TrendLine.txt

Sto Divergence TrendLine.pla

Sto Divergence TrendLine.ELD

Share this post


Link to post
Share on other sites

Hello,

 

I give you my version. I use it with various indicators. I think the author is Marplex.

Sorry for my bad english.

 

inputs: periodlen(1),colorH(white), colorL(yellow),period(30),smooth(1),type(1),length(20),leftstrength(3),RightStrength(1),Bartol(3);
vars: Pivotprice1(0), pivotbar1(0),Pivotprice2(0), pivotbar2(0),Pivotprice3(0), pivotbar3(0),Pivotprice4(0), pivotbar4(0),
Pivotprice5(0), pivotbar5(0),Pivotprice6(0), pivotbar6(0),Pivotprice7(0), pivotbar7(0),Pivotprice8(0), pivotbar8(0);

value1=[color="Red"]yourindicator[/color](periodlen);

//market pivot:

// pivot low
condition3 = pivot(low,length,leftstrength,RightStrength,1,-1,pivotprice3,pivotbar3)<>-1;
condition4 = pivot(low,length,leftstrength,RightStrength,2,-1,pivotprice4,pivotbar4)<>-1;

//pivot high
condition5 = pivot(high,length,leftstrength,RightStrength,1,1,pivotprice5,pivotbar5)<>-1;
condition6 = pivot(high,length,leftstrength,RightStrength,2,1,pivotprice6,pivotbar6)<>-1;


//indicator pivot:


//pivot low
condition1 = pivot(value1,length,leftstrength,RightStrength,1,-1,pivotprice1,pivotbar1)<>-1;
condition2 = pivot(value1,length,leftstrength,RightStrength,2,-1,pivotprice2,pivotbar2)<>-1;


//pivot high
condition7 = pivot(value1,length,leftstrength,RightStrength,1,1,pivotprice7,pivotbar7)<>-1;
condition8 = pivot(value1,length,leftstrength,RightStrength,2,1,pivotprice8,pivotbar8)<>-1;

//last low

if condition3 and condition4 and condition2 and condition1 
and (absvalue(pivotbar1-pivotbar3)<bartol)
and (absvalue(pivotbar2-pivotbar4)<bartol)
and(pivotbar3=RightStrength or pivotbar1 = RightStrength)
and (Pivotprice3<=Pivotprice4 and pivotprice1>Pivotprice2)
and barstatus(1)=2 then begin

value2 = tl_new_s(D[pivotbar4],time_s[pivotbar4],l[pivotbar4],D[pivotbar3],time_s[pivotbar3],l[pivotbar3]);
tl_setcolor(value2,colorL);
tl_setsize(value2,3);
end;

//last high

if condition5 and condition6 and condition7 and condition8 
and (absvalue(pivotbar7-pivotbar5)<bartol)
and (absvalue(pivotbar8-pivotbar6)<bartol)
and(pivotbar5=RightStrength or pivotbar7 = RightStrength)
and (Pivotprice5>=Pivotprice6 and pivotprice7<Pivotprice8)
and barstatus(1)=2 then begin

value3 = tl_new_s(D[pivotbar6],time_s[pivotbar6],h[pivotbar6],D[pivotbar5],time_s[pivotbar5],h[pivotbar5]);
tl_setcolor(value3,colorh);
tl_setsize(value3,3);
end;

 

Sincerely,

Franck

Share this post


Link to post
Share on other sites

Hi Xavi7

This indicator is written for an Easy Language platform

I guess that it is possible to make a translation for any other platform.

rgds

Edited by aaa

Share this post


Link to post
Share on other sites

I was able to apply divergence to both the price and indicator. Thank you AAA for putting the original together. The below modification applies to the stochrsi:

 

 

// StochRSI Divergence TrendLine
// Author: MARKPLEX
// http://markplex.com/tutorial4.php
// version: 1.0

// Author: aaa
// version: 2.0
// Date: 20091129
// added: 
// divergence on top +
// Line.Color.Top + Line.Color.Bot + Line.Size + Plot.Sto in inputs

//----------------------------------------------------
inputs:
//----------------------------------------------------


RSILength(9),
StochLength(18),
KLength(6),
DLength(3),
OverSold(20),
OverBought(80),
Length(20),
LeftStrength(3),
RightStrength(3),
Line.Color.Top(red),
Line.Color.Bot(blue),
Line.Size(2),
Plot.stochrsi(1);

//---------------------------------------------------- 
variables:
//----------------------------------------------------

DToscK(0), 
DToscD(0),

oPivotPrice1(0),
oPivotBar1(0),
oPivotPrice2(0),
oPivotBar2(0),

oPivotPrice11(0),
oPivotBar11(0),
oPivotPrice12(0),
oPivotBar12(0);

value1 = FastKCustomEasy(RSI(C, RSILength),StochLength);
DToscK =  average(value1,KLength);
DToscD = average(DToscK,DLength);

Condition1 = Pivot( DToscK, Length, LeftStrength, RightStrength, 1, -1, oPivotPrice1, oPivotBar1 ) <> -1 
	AND ( oPivotBar1 - RightStrength ) = 0 ;

Condition11 = Pivot( DToscK, Length, LeftStrength, RightStrength, 1, 1, oPivotPrice11, oPivotBar11 ) <> -1 
	AND ( oPivotBar11 - RightStrength ) = 0 ;

Condition2 = Pivot( DToscK, Length, LeftStrength, RightStrength, 2, -1, oPivotPrice2, oPivotBar2 ) <> -1;

Condition12 = Pivot( DToscK, Length, LeftStrength, RightStrength, 2, 1, oPivotPrice12, oPivotBar12 ) <> -1;

If 
	Condition1 and Condition2 // added condition2 = referecne future data
	AND L[oPivotBar2] >= L[oPivotBar1] 
	AND DToscK[oPivotBar2] < DToscK[oPivotBar1] then 
Begin
	Value2 = TL_New(D[oPivotBar2], T[oPivotBar2], L[oPivotBar2], D[oPivotBar1], T[oPivotBar1], L[oPivotBar1]); 
	TL_SetColor( Value2, Line.Color.Bot );
	TL_SetSize(  Value2, Line.Size  );
End;

If 
	Condition11 and Condition12 // added condition12  referecne future data
	AND H[oPivotBar12] <= H[oPivotBar11] 
	AND DToscK[oPivotBar12] > DToscK[oPivotBar11] then 
Begin
	Value12 = TL_New(D[oPivotBar12], T[oPivotBar12], H[oPivotBar12], D[oPivotBar11], T[oPivotBar11], H[oPivotBar11]); 
	TL_SetColor( Value12, Line.Color.Top );
	TL_SetSize(  Value12, Line.Size  );
End;

if Plot.stochrsi <> 0 then	
Plot1( DToscK );


condition3 = Pivot( DToscK, Length, LeftStrength, RightStrength, 1, -1, oPivotPrice1, oPivotBar1 ) <> -1 
	AND ( oPivotBar1 - RightStrength ) = 0 ;

condition32 = Pivot( DToscK, Length, LeftStrength, RightStrength, 1, 1, oPivotPrice11, oPivotBar11 ) <> -1 
	AND ( oPivotBar11 - RightStrength ) = 0 ;

condition4 = Pivot( DToscK, Length, LeftStrength, RightStrength, 2, -1, oPivotPrice2, oPivotBar2 ) <> -1;

condition42 = Pivot( DToscK, Length, LeftStrength, RightStrength, 2, 1, oPivotPrice12, oPivotBar12 ) <> -1;

If 
	Condition3 and condition4 
	AND L[oPivotBar2] >= L[oPivotBar1] 
	AND DToscK[oPivotBar2] < DToscK[oPivotBar1] then 
Begin
	Value2 = TL_New_SELF(D[oPivotBar2], T[oPivotBar2], DToscK[oPivotBar2], D[oPivotBar1], T[oPivotBar1], DToscK[oPivotBar1]); 
	TL_SetColor( Value2, Line.Color.Bot );
	TL_SetSize(  Value2, Line.Size  );
End;

If 
	Condition32 and Condition42
	AND H[oPivotBar12] <= H[oPivotBar11] 
	AND DToscK[oPivotBar12] > DToscK[oPivotBar11] then 
Begin
	Value12 = TL_New_SELF(D[oPivotBar12], T[oPivotBar12], DToscK[oPivotBar12], D[oPivotBar11], T[oPivotBar11], DToscK[oPivotBar11]); 
	TL_SetColor( Value12, Line.Color.Top );
	TL_SetSize(  Value12, Line.Size  );
End;

Plot1( DToscK, "stochrsi",      white );
plot2( 20,    "oversold", white);
plot3(80, "overbought", white);

StochRSI Divergence.pla

Share this post


Link to post
Share on other sites

AAA thank you for sharing valuable information i just only have a quick questions in regards of code divergences . how can i use it on radar screen tradesation Platform.... like cell background color as soon trend line is set ? currently i have something but alert comes too late like 3 candles after..regards

Share this post


Link to post
Share on other sites

currently i have something but alert comes too late like 3 candles after..regards

 

Hi JaimSierra

 

Bad news ;

Pivot function needs x Bars back 2 detect a signal

2 bad :(

 

Good news

It's possible, with array or a different logical approch, 2 detect a pivot in RealTime showing a divergence, or a ZigZag, or whatever indicator.

2 good :)

 

regards

 

PS others divergences indicators here based on the same MARKPLEX code

http://www.traderslaboratory.com/forums/10979-aaa/

 

Markplex very nice site here

http://markplex.com/free-tutorials/

 

 
//----------------------------------------------------
inputs:
//----------------------------------------------------
StochLength(  14 ), 
Length(  20 ),
[color=blue][u][b]LeftStrength( [size=7]3[/size]  ), [/b][/u][/color]
RightStrength( 1  ),



[center][size=3][b]Pivot (Function)[/b][/size][/center]


The Pivot function returns the value of a pivot point and the number of bars ago the pivot occurred.

Syntax
Pivot(Price, Length, LeftStrength, RightStrength, Instance, HiLo, oPivotPrice, oPivotBar)

Returns (Integer)
The oPivotPrice and oPivotBar output parameters return the price value of the pivot point and the number of bars ago it occurred.  The Pivot function itself returns a value of 1 if a pivot is found, and -1 if not found.

Parameters

Price
Specifies which bar value (price, function, or formula) to be considered.

Length
Sets the number of bars to consider for the pivot.

[b][color=blue][u]LeftStrength[/u][/color][/b]
[b][color=blue][u]Sets the required number of bars on the left side of the pivot bar.[/u][/color][/b]

RightStrength
Sets the required number of bars on the right side of the pivot bar.

Instance
Sets which occurrence (that is, 1 = most recent, 2 = 2nd most recent, and so on) to return.

HiLo
Sets which pivot values to return, 1 = High, -1 = Low.

oPivotPrice
Outputs the specified bar value at the pivot point.

oPivotBar
Outputs the number of bars ago the pivot point occurred.

Remarks
This function is used to find pivot or swing points.  This function allows you to specify variable strength sides, as well as whether the pivot point should be a high or low pivot.

Example
Assigns to Value2 the most recent pivot low price over the last 21 bars and to Value3 the number of bars ago the pivot low occurred using a left strength of 4 and a right strength of 2.
Vars: oPivotPrice(0), oPivotBar(0);
Value1 = Pivot(Low,21,4,2,1,-1,oPivotPrice,oPivotBar);
Value2 = oPivotPrice;
Value3 = oPivotbar;

Edited by aaa

Share this post


Link to post
Share on other sites

Gm all I' ve found out that if you combine multiple frames you can use the indicator in lower time frames with signals from higher time frames. Result. Signal shows up sooner. Combine 2 time frames in a chart and set indicator on the higher time frame ; 5m & 15m Set indicator on 15m on a 5 m chart. You "ll see sooner and precise alerts in 5m regarding 15m divergences. Hope help. Regards

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

    • Date: 22nd January 2025.   Netflix Earnings Surge Driving the NASDAQ to Monthly Highs!   The NASDAQ increases in value for a fourth consecutive day, gaining momentum after Netflix stocks rise more than 15%. Earnings reports are gaining speed for the technology sector, but why has Netflix stocks seen such a high and sudden rise in demand? Netflix Stocks Increase 15% Supporting the NASDAQ! Netflix stocks have been one of the best-performing stocks within the NASDAQ, rising more than 79% in 12 months. However, even for Netflix, a 15% rise in less than 24 hours is considered substantial. The quarterly earnings report was made public by Netflix after the market closed on Tuesday. The earnings report confirmed the following: Netflix beat their earnings per share expectations - $4.27 reported vs $4.21 expectations. Netflix’s revenue surpasses the previous quarter - $10.25 billion this quarter vs $9.82 billion in the previous quarter. The online streaming company confirms projects to expand into live sport and event streaming will proceed. In addition to this, the company’s forward guidance for 2025 remains positive. Netflix is the 10th most influential company for the NASDAQ meaning the positive earnings data and bullish price movement supports the overall price of the NASDAQ. In addition to this, the positive earnings improve the sentiment towards the entire US technology sector. Investors will now turn their attention to the quarterly earnings report for Intuitive Surgical. Intuitive Surgical stocks on Tuesday rose 1.94%. How is the Economy And Politics Affecting the NASDAQ?     The US stock market is witnessing an upward correction after struggling in the last weeks of 2024. The bullish price movement is a result of a sharp decline in bond yields, the new US administration and earnings season. Investors remain relieved that bond yields have fallen back down from the 5.00% level. If bond yields continue to decline further, particularly below 4.50%, the move would be deemed as positive for the US stock market. President Trump took office on Monday and so far the pro-US rhetoric from the President, Vice President and Secretary of State continues to support the stock market. So far, the main concern is how upcoming tariffs can negatively affect inflation and growth. However, some economists advise tariffs will become the “norm” and may have a lesser effect compared to 2018. However, this is something traders will continue to evaluate and monitor. The VIX this morning fell 0.83% lower and trades more than 5.70% lower over a 7-days. The lower VIX indicates a higher risk appetite towards the stock market. If the VIX continues to decline a strong buy indication may materialize. On the most influential stocks for the NASDAQ, 82% rose in value on Tuesday. However, Apple stocks, the most impactful stock, fell 3.19% due to poor sell data. If Apple stocks continue to decline, the NASDAQ’s upward trend may come under strain. In the meantime, investors over the next week will continue to monitor upcoming earnings reports. NASDAQ - Technical Analysis The price of the index is trading significantly higher than all Moving Averages on a 2-hour timeframe and relatively high on oscillators. These factors indicate that buyers are controlling the order book. However, price action also confirms the latest impulse wave measures 3.43% which is normally the point at which the index retraces. This is something that investors may also consider. The retracement potentially also may be triggered by Netflix buyers quickly selling to cash in profit after the sudden 15% bullish surge. If a retracement does indeed form, price action and the 75-period EMA indicates that the pullback may drop as low as $21,391.30.     Key Takeaways: The NASDAQ increases in value for a fourth consecutive day, but price action signals a possible retracement before continuing its bullish trend. Netflix stocks increase more than 15% due to strong earnings data. Netflix beat earnings and revenue expectations by 1.39% and confirmed projects to add live sports streaming to its platforms. The VIX trades more than 5.70% lower over a 7-days and US Bond Yields remain at recent lows. On the most influential stocks for the NASDAQ, 82% rose in value on Tuesday. 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.
    • DASH DoorDash stock, watch for a top of range breakout at https://stockconsultant.com/?DASH
    • SYF Synchrony Financial stock with a top of range breakout at https://stockconsultant.com/?SYF
    • RKLB Rocket Labstock, big rally off support and breakout at https://stockconsultant.com/?RKLB
    • RDW Redwire stock, what a launch off the 14.16 support area at https://stockconsultant.com/?RDW
×
×
  • Create New...

Important Information

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