NexusFi: Find Your Edge


Home Menu

 





Plotting Issue(support/resistance)


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one ccansonchan with 2 posts (0 thanks)
    2. looks_two Quick Summary with 1 posts (0 thanks)
    3. looks_3 kjhosken with 1 posts (0 thanks)
    4. looks_4 ABCTG with 1 posts (1 thanks)
    1. trending_up 1,644 views
    2. thumb_up 1 thanks given
    3. group 3 followers
    1. forum 4 posts
    2. attach_file 2 attachments




 
Search this Thread

Plotting Issue(support/resistance)

  #1 (permalink)
ccansonchan
Hong Kong
 
Posts: 4 since May 2019
Thanks Given: 1
Thanks Received: 0

Hello to all and thankyou for reading this;

I am new in Multicharts and Easy language

My problem is that

1) How can those support and resistance line wont appear at the same time ?

For example : when support appear resistance hide

2) How to put text next to those line ?

When I'm currently facing


What I expect



Hers is my code

Inputs: Price((H+L)/2),


Vars: Smooth (0),Detrender (0) , I1 (0), Q1 (0), jI (0), JQ (0), I2 (0), Q2 (0), Re (0), Im (0), Period (0), SmoothPeriod (0), SmoothPrice (0), DCPeriod (0), RealPart (0),
Imagpart (0), count (0), DCPhase (0), DCSine (0), LeadSine (0), Itrend (0), Trendline (0),
Trend (0), DaysinTrend (0), Redsine (0), BlueLeadSine (0), support (0), resistence (0), srline (0);

If CurrentBar > 5 then begin
Smooth = (4*Price + 3*Price[1] + 2*Price[2] + Price[3]) / 10;
Detrender = (.0962 * Smooth + .5769 * Smooth[2] - .5769 * Smooth[4] - .0962*Smooth[6]) * (.075 * Period[1] + .54);


{Compute InPhase and Quadrature components.}
Q1 = (.0962 * Detrender + .5769 * Detrender[2] - .5769 * Detrender[4] - .0962 * Detrender[6]) * (.075 * Period[1] + .54);
I1 = Detrender[3];

{Advance the phase of I1 and Q1 by 90 degrees}
jI = (.0962 * I1 + .5769 * I1[2] - .5769 * I1[4] - .0962 * I1[6]) * (.075 * Period[1] + .54);
JQ = (.0962 * Q1 + .5769 * Q1[2] - .5769 * Q1[4] - .0962 * Q1[6]) * (.075 * Period[1] + .54);

{Phasor addition for 3 bar averaging)}
I2 = I1 - JQ;
Q2 = Q1 + jI;

{Smooth the I and Q components before applying the discriminator}
I2 = .2 * I2 + .8 * I2[1];
Q2 = .2 * Q2 + .8 * Q2[1];

{Homodyne Discriminator}
Re = I2 * I2[1] + Q2 * Q2[1];
Im = I2 * Q2[1] - Q2 * I2[1];
Re = .2 * Re + .8 * Re[1];
Im = .2 * Im + .8 * Im[1];

If Im <> 0 and Re <> 0 then Period = 360 / ArcTangent (Im/Re);
If Period > 1.5 * Period[1] then Period = 1.5 * Period[1];
If Period < .67 * Period[1] then Period = .67 * Period[1];
If Period < 6 then Period = 6;
If Period > 50 then Period = 50;
Period = .2 * Period + .8 * Period[1];
SmoothPeriod = .33 * Period + .67 * SmoothPeriod[1];

{Compute Dominant Cycle Phase}
SmoothPrice = (4 * price + 3 * Price[1] + 2 * Price[2] + Price[3]) / 10;
DCPeriod = IntPortion(SmoothPeriod + .5);
RealPart = 0;
ImagPart = 0;


For count = 0 To DCPeriod - 1 begin
RealPart = RealPart + sine (360 * count / DCPeriod) *
(SmoothPrice[count]);
ImagPart = imagPart + CoSine (360 * count / DCPeriod) *
(SmoothPrice[count]);
End;

If AbsValue(ImagPart) > 0
then DCPhase = Arctangent(RealPart / ImagPart);
If AbsValue(ImagPart) <= .001
then DCPhase = DCPhase + 90 * Sign(RealPart);

DCPhase = DCPhase + 90;

{Compensate for one bar lag of the Weighted Moving Average}
DCPhase = DCPhase + 360 / SmoothPeriod;

If ImagPart < 0 then DCPhase = DCPhase + 180;
If DCPhase > 315 then DCPhase = DCPhase - 360;

Redsine = (Sine(DCPhase));
BlueLeadSine = (Sine(DCPhase + 45));

//Plot1((Redsine), "Sine");
//Plot2((BlueLeadSine), "LeadSine");

If BlueLeadSine cross over Redsine
then support = L;

If BlueLeadSine cross under Redsine
then resistence = H;


Plot3((support), "support");
Plot4((resistence), "resistence");

end;

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Ninja Mobile Trader VPS (ninjamobiletrader.com)
Trading Reviews and Vendors
Better Renko Gaps
The Elite Circle
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
NexusFi Journal Challenge - April 2024
Feedback and Announcements
Deepmoney LLM
Elite Quantitative GenAI/LLM
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
59 thanks
Funded Trader platforms
37 thanks
NexusFi site changelog and issues/problem reporting
22 thanks
GFIs1 1 DAX trade per day journal
22 thanks
The Program
20 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623


ccansonchan,

I am not sure what exactly you mean with " How can those support and resistance line wont appear at the same time ?", but in general when you display plots at the same value they will overlap. One idea could be to use a different color in that situation or to slightly shift one of the values up or down, so you can easily spot the two values at the same price.

For displaying text you will need to use text drawings and you might also find the free EasyLanguage Essentials PDF helpful that covers a lot of the basics including drawings:
https://uploads.tradestation.com/uploads/EasyLanguage-Essentials.pdf

Regards,

ABCTG


ccansonchan View Post
Hello to all and thankyou for reading this;

I am new in Multicharts and Easy language

My problem is that

1) How can those support and resistance line wont appear at the same time ?

For example : when support appear resistance hide

2) How to put text next to those line ?


Follow me on Twitter Reply With Quote
Thanked by:
  #4 (permalink)
 kjhosken 
Seattle, WA/USA
 
Experience: Intermediate
Platform: TOS, TS
Trading: Forex, crude
Posts: 96 since Sep 2016
Thanks Given: 7
Thanks Received: 35

The lines are plotting based off the lower indicator action. One set of dots appears when the blue crosses over the red and another set appear when the red crosses over the blue. Not sure if this would work ( I'm at work and can't verify the code, but perhaps try this:

 
Code
 
If BlueLeadSine cross over Redsine then begin
    support = L;
    resistance = resistance[1];
end;
If BlueLeadSine cross under Redsine then begin
    resistence = H;
    support = support[1];
end;

Follow me on Twitter Reply With Quote
  #5 (permalink)
ccansonchan
Hong Kong
 
Posts: 4 since May 2019
Thanks Given: 1
Thanks Received: 0

Yep, I am wondering is it better to have resistance and the support mark in one line. That is easier to identify the trend easier.

Reply With Quote




Last Updated on May 27, 2019


© 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