How to put in sequence this point?

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

How to put in sequence this point?

Postby gian9081 » 11 Jan 2015

Hello,
could anyone help me?
i would like to represent in sequence, alternating, with the Plot the two point (Price[3] and Price1[3]) that respect the two conditions that were imposed.
I hope that someone can help me. I attached the first part of the code.

inputs: Price ( Low ), Price1 ( High ), RightStrenght ( 3 ) ;
vars: min1 ( 0 ), max1 ( 0 );


condition1 = Price[3]<Price[4] And Price[3]<Price[5] And Price[3]<Price[6] And Price[3]<Price[2] And
Price[3]<Price[1] And Price[3]<Price;
condition2 = Price1[3]>Price1[4] And Price1[3]>Price1[5] And Price1[3]>Price1[6] And
Price1[3]>Price1[2] And Price1[3]>Price1[1] And Price1[3]>Price1;

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: How to put in sequence this point?

Postby TJ » 11 Jan 2015

Hello,
could anyone help me?
i would like to represent in sequence, alternating, with the Plot the two point (Price[3] and Price1[3]) that respect the two conditions that were imposed.
I hope that someone can help me. I attached the first part of the code.
inputs: Price ( Low ), Price1 ( High ), RightStrenght ( 3 ) ;
vars: min1 ( 0 ), max1 ( 0 );
condition1 = Price[3]<Price[4] And Price[3]<Price[5] And Price[3]<Price[6] And Price[3]<Price[2] And
Price[3]<Price[1] And Price[3]<Price;
condition2 = Price1[3]>Price1[4] And Price1[3]>Price1[5] And Price1[3]>Price1[6] And
Price1[3]>Price1[2] And Price1[3]>Price1[1] And Price1[3]>Price1;
Can you draw a mock up of what you intended to see?

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: How to put in sequence this point?

Postby TJ » 11 Jan 2015

ps.
[FAQ] How to Post Codes (that people can read)
viewtopic.php?f=16&t=11713

gian9081
Posts: 14
Joined: 08 Jan 2015
Has thanked: 1 time

Re: How to put in sequence this point?

Postby gian9081 » 11 Jan 2015

sorry if i post the code in the wrong way.
I would like to represent in the graph with the plot, points that stand for Price[3] and Price1[3];
i would like to put in sequence like this: Price[3], Price1[3], Price[3], Price1[3], Price[3], Price1[3], ecc.

I attached a figure of what i found with a code that i created. The problem is that i want to found the points alternating like i said. Price[3], Price1[3], Price[3], Price1[3]; instead i found the points mix each other. In the figure i connecting the dots to make an example of what points i want, and exclude the other that are between.
Attachments
MultiCharts1.png
(35.35 KiB) Downloaded 694 times

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: How to put in sequence this point?

Postby TJ » 11 Jan 2015

sorry if i post the code in the wrong way.
I would like to represent in the graph with the plot, points that stand for Price[3] and Price1[3];
i would like to put in sequence like this: Price[3], Price1[3], Price[3], Price1[3], Price[3], Price1[3], ecc.
I attached a figure of what i found with a code that i created. The problem is that i want to found the points alternating like i said. Price[3], Price1[3], Price[3], Price1[3]; instead i found the points mix each other. In the figure i connecting the dots to make an example of what points i want, and exclude the other that are between.
Tip #1:

Get rid of those condition1 condition2...

nobody is going to weave through your convoluted logics to guess what you are trying to do.

Instead, give a meaningful name to the "condition1"... something that will lend meaning to the code, and let you follow the logic when you code and read... and help you in the inescapable debugging process.

gian9081
Posts: 14
Joined: 08 Jan 2015
Has thanked: 1 time

Re: How to put in sequence this point?

Postby gian9081 » 11 Jan 2015

Sorry, i know that i am a recruit, but if i delete the two conditions how can i represent what i want? Can you make an example of what you mean?

gian9081
Posts: 14
Joined: 08 Jan 2015
Has thanked: 1 time

Re: How to put in sequence this point?

Postby gian9081 » 11 Jan 2015

I attached the entire code so maybe it will be clearer.

Code: Select all

inputs: Price ( Low ), Price1 ( High ), RightStrenght ( 3 ) ;
vars: min1 ( 0 ), max1 ( 0 );


condition1 = Price[3]<Price[4] And Price[3]<Price[5] And Price[3]<Price[6] And Price[3]<Price[2] And Price[3]<Price[1] And Price[3]<Price;
condition2 = Price1[3]>Price1[4] And Price1[3]>Price1[5] And Price1[3]>Price1[6] And
Price1[3]>Price1[2] And Price1[3]>Price1[1] And Price1[3]>Price1;
if condition1 then
begin
min1 = Price[3];

Plot1[RightStrenght]( min1, "swing Low" );

end
else
min1=0;

NoPlot ( 1 );
if condition2 then
begin
max1 = Price1[3];

Plot2[RightStrenght]( max1, "swing High" );

end
else
max1=0;

min1 = 0;
NoPlot ( 1 );
NoPlot ( 2 );

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: How to put in sequence this point?

Postby TJ » 11 Jan 2015

::
condition1 = Price[3]<Price[4] And Price[3]<Price[5] And Price[3]<Price[6] And Price[3]<Price[2] And Price[3]<Price[1] And Price[3]<Price;
::
Ask yourself... What are you trying to achieve here? What are you trying to get out of the convoluted logic?

After you gave yourself the answer, then replace the word "condition1" with your answer.



You see, only you know the "answer"... everybody else reading the line is just guessing.

gian9081
Posts: 14
Joined: 08 Jan 2015
Has thanked: 1 time

Re: How to put in sequence this point?

Postby gian9081 » 11 Jan 2015

Mean you a swingpoint?

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: How to put in sequence this point?

Postby TJ » 11 Jan 2015

Mean you a swingpoint?
If the line of logic gives you the swingpoint, then call it the swingpoint, why call it condition1 ???
What is condition1 anyway? It is not a shampoo?

gian9081
Posts: 14
Joined: 08 Jan 2015
Has thanked: 1 time

Re: How to put in sequence this point?

Postby gian9081 » 11 Jan 2015

You are right. I call condition1 because i want, like a condition, that it was respected. The Price that i search must be less than the price of the previous three days and than of the price next three days ( in the case of LowPrice ); Price1 istead must be greater than the price of the price of the previous three days and than of the price next three days. For this i put the conditions. With the swing i don't know how to do this. For this i need some help.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: How to put in sequence this point?

Postby TJ » 11 Jan 2015

note: // <--- is this supposed to be a BEGIN END block?

[quote="gian9081"]

Code: Select all

::
if condition1 then
begin
min1 = Price[3];

Plot1[RightStrenght]( min1, "swing Low" );

end
else // <--- is this supposed to be a BEGIN END block?

min1=0;

NoPlot ( 1 );
::

gian9081
Posts: 14
Joined: 08 Jan 2015
Has thanked: 1 time

Re: How to put in sequence this point?

Postby gian9081 » 11 Jan 2015

i put that because i think that if the condition1 wasn't met, then it must not be plot. I know that there are some problem with the "else", both in the first condition and the second. But i don't understand where i wrong and how to write it

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: How to put in sequence this point?

Postby TJ » 11 Jan 2015

i put that because i think that if the condition1 wasn't met, then it must not be plot. I know that there are some problem with the "else", both in the first condition and the second. But i don't understand where i wrong and how to write it
try this: (see // <-- added )

Code: Select all

//::
if swingpoint = true then // <-- changed name
begin
min1 = Price[3];

Plot1[RightStrenght]( min1, "swing Low" );

end
else
BEGIN // <-- added

min1=0;

NoPlot ( 1 );

END; // <-- added
//::

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: How to put in sequence this point?

Postby TJ » 11 Jan 2015

I have to stop here. I will let others give you a hand.
I will be back later.

gian9081
Posts: 14
Joined: 08 Jan 2015
Has thanked: 1 time

Re: How to put in sequence this point?

Postby gian9081 » 11 Jan 2015

And what about the second "if"?


Return to “MultiCharts”