How to find this point  [SOLVED]

Questions about MultiCharts and user contributed studies.
gian9081
Posts: 14
Joined: 08 Jan 2015
Has thanked: 1 time

How to find this point  [SOLVED]

Postby gian9081 » 20 Jan 2015

Hello,
Could anyone help me please?
i want to find two points in sequence: min1 and max1. But i want to represent, with the plot, max1 only if it is higher than min1 ( max1 > min1 ); in the contrary case ( if max1 < min1 ) i want that nothing it is represent, both min1 and max1. How can i do this? Why the code i try to write doesn't do this? Where am i wrong?

Code: Select all

inputs: Price ( Low ), Price1 ( High ), RightStrength ( 3 ), LeftStrength ( 3 );
vars: var0 ( 0 ), var1 ( 0 ), min2 ( 0 ), hold ( 0 );
Array: EArray[2](0);

condition1=hold=0 or hold=2;
condition2=hold=0 or hold=1;


var0 = PivotHighVSBar( 1, Price1, LeftStrength, RightStrength, RightStrength + 1 ) ;
var1 = PivotLowVSBar( 1, Price, LeftStrength, RightStrength, RightStrength + 1 ) ;

if var1 <> -1 and condition1 then
begin
min1 = Low;
EArray[1]=min1;
Plot1[RightStrength]( Low[RightStrength], "min1");
print(EArray[1]);
hold = 1;
end
else
min1 = 0;
EArray[1]=0;
NoPLot ( 1 );
//hold=0;

if condition2 then
max1 = High;
if (max1 > min1 and var0 <> -1) then
begin
EArray[2]=max1;
Plot2[RightStrength]( High[RightStrength], "max1");
print(EArray[2]);
hold=2;
end
else
max1=0;
EArray[2]=0;
EArray[1]=0;
min1 = 0;
NoPlot ( 2 );
//hold=0;

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: How to find this point

Postby JoshM » 21 Jan 2015

(..) i want to represent, with the plot, max1 only if it is higher than min1 ( max1 > min1 ); in the contrary case ( if max1 < min1 ) i want that nothing it is represent, both min1 and max1. How can i do this?
If I understand correctly, you mean something like this?

Code: Select all

Variables:
max1(0), min1(0);

if (max1 > min1) then
Plot1(max1, "Max1")
else if (max1 < min1) then
NoPlot(1);
For more on `NoPlot()`, see Wiki: NoPlot().


Return to “MultiCharts”