### Author Topic: I need your help ploting this chart conditions  (Read 3384 times)

#### almaa

• Newbie
• Posts: 1
##### I need your help ploting this chart conditions
« on: December 27, 2012, 01:44:10 pm »
I am facing adifficulty showing clearly (ONLY CLOSING CANDLES) of the current formula which I will post at the end.
What I need is to set an (if condition) to control the ploting for the Resistance & Support of a particular stock at the end of a trading day (closing).
What I am getting now is all the lines of R1, R2, etc.

EXAMPLE;
If a stock (X) closed between resistance 1 (R1) & resistance 2 (R2), show R1 & R2 ONLY. Ignore other supports and resistances

If a stock (Y) closed between support 1 (S1) & support 2 (S2), show S1 & S2 ONLY, ignore the other resistances & supports.
-----------------
here is the AFL FORMULA, THANKS IN ADVANCE FOR THE SUPPORT
------------------

Opm=TimeFrameGetPrice( "O", inMonthly, 0);

Hpm=TimeFrameGetPrice( "H", inMonthly, 0);

Lpm=TimeFrameGetPrice( "L", inMonthly, 0);

Cpm=TimeFrameGetPrice( "C", inMonthly, 0);

L1=-Lpm+(Hpm+2*Lpm+Cpm)/2;
H1=-Lpm+(2*Hpm+Lpm+Cpm)/2;
EQ1=-Lpm+(Hpm+Lpm+2*Cpm)/2;
L2=-Hpm+(Hpm+2*Lpm+Cpm)/2;
H2=-Hpm+(2*Hpm+Lpm+Cpm)/2;
EQ2=-Hpm+(Hpm+Lpm+2*Cpm)/2;
HNEW=(H1/H2-1)*100;
lnEW=(L1/L2-1)*100;
EQNEW=(EQ1/EQ2-1)*100;

HSELL1=-LPM+(HPM+2*LPM+CPM)/2;
HSELL2=-LPM+(2.*HPM+LPM+CPM)/2;
HSELL3=-LPM+(HPM+LPM+2.*CPM)/2;
PP=(Cpm+Lpm+Hpm)/3;
R1=PP*2-Lpm;
S1=PP*2-Hpm;
S2=PP+(S1-R1);
R2=PP-(S1-R1);
"=====================================\n";

Plot( HSELL2, "HSELL2", colorGreen, styleLine );

"=======================================\n";

Plot( HSELL1, "HSELL1", colorOrange, styleDashed );

Plot( S1, "S1", colorBlack, styleLine );
Plot( R1, "R1", colorBlack, styleLine );
Plot( PP, "PP", colorBlue, styleLine );
Plot( S2, "S2", colorBlack, styleLine );
Plot( R2, "R2", colorBlack, styleLine );

_SECTION_BEGIN("Price1");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();