Indicator not correct value

Questions about MultiCharts and user contributed studies.
tradingest
Posts: 283
Joined: 05 Dec 2014
Location: Italy
Has thanked: 53 times
Been thanked: 3 times

Indicator not correct value

Postby tradingest » 24 Jul 2016

Hi all,

why I see the wrong value with this indicator?

Code: Select all

Var: Length(50), DCHi(0), DCLo(0), BarPercentage(50);

DCHi = Highest(C,Length);
DCLo = Lowest(C,Length);

condition10 = O > C and H - O > O - C and C - L < O - C;
condition20 = H > DCHi;

If condition10 and condition20
then begin
Plot1(H, "Hammer");
end;
The H value in the chart below is different from the value column z_Shooting.

Image
Image

Why?

Thanks,
tradingest
Attachments
PM.JPG
(71.09 KiB) Downloaded 1416 times
Immagine 1.png
(42.21 KiB) Downloaded 1416 times

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

Re: Indicator not correct value

Postby TJ » 24 Jul 2016

What's different?

tradingest
Posts: 283
Joined: 05 Dec 2014
Location: Italy
Has thanked: 53 times
Been thanked: 3 times

Re: Indicator not correct value

Postby tradingest » 24 Jul 2016

why not!!

The value into column z_shooting is the H value but that is different from H value candle.

Why?

The value should be showed if the H > DCHi. In this case is not true, H < DCHi.

User avatar
bensat
Posts: 331
Joined: 04 Oct 2014
Has thanked: 46 times
Been thanked: 104 times

Re: Indicator not correct value

Postby bensat » 24 Jul 2016

Tradingest,

you could work a little bit on your 'writing behavior'. Your comments always read like 'passive aggressive'. Just my 2cents.

Regarding your problem. Your code is fine and I can assure that MC does it's job perfectly with it.
Please find the values in this screenshot :

Image

May the difference between chart & scanner is related to different amount of data you load in the chart & the scanner. Make sure you both data are the same ...

Regards.

Ben

tradingest
Posts: 283
Joined: 05 Dec 2014
Location: Italy
Has thanked: 53 times
Been thanked: 3 times

Re: Indicator not correct value

Postby tradingest » 24 Jul 2016

many thanks bensat,

how I can make to set the same data between scanner and charts?
I have imported the symbols into scanner and I thought hat the data show is the last.

Can you help me to set the same data?

Thanks,
tradingest

User avatar
bensat
Posts: 331
Joined: 04 Oct 2014
Has thanked: 46 times
Been thanked: 104 times

Re: Indicator not correct value

Postby bensat » 25 Jul 2016

Just be sure to load the same amount of data in chart & scanner with <FORMAT INSTRUMENT> and load the same time frame, same amount of bars or days back ... Further make sure that both are being analysed after a bar is closed or both in 'realtime'.

This should make sure your indicator is looking for the same data.

Regards.

Ben

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

Re: Indicator not correct value

Postby TJ » 25 Jul 2016

Look up the keyword:

ELSE

User avatar
bensat
Posts: 331
Joined: 04 Oct 2014
Has thanked: 46 times
Been thanked: 104 times

Re: Indicator not correct value

Postby bensat » 25 Jul 2016

I may made a mistake and have to update my answer. You were asking to plot H = high of the bar or the DCHi = Highest(C,Length); ? Looks like in the chart you are plotting DCHi and not H ... is that correct ?

Regards

Ben

tradingest
Posts: 283
Joined: 05 Dec 2014
Location: Italy
Has thanked: 53 times
Been thanked: 3 times

Re: Indicator not correct value

Postby tradingest » 25 Jul 2016

Hi Ben,

I plot H

User avatar
bensat
Posts: 331
Joined: 04 Oct 2014
Has thanked: 46 times
Been thanked: 104 times

Re: Indicator not correct value

Postby bensat » 25 Jul 2016

I downloaded the data and what the scanner shows is 100% correct ... I have the same value 103.82 shown in chart & scanner.

Image

You draw a handmade circle on a wrong place !!! PLEASE be aware of your code and your conditions !!! Condition20 says H > DCHi .... Further you need to change the PLOT-style for Plot1 to see it in the chart.

Check it on your own ....

Regards.

Ben

User avatar
bensat
Posts: 331
Joined: 04 Oct 2014
Has thanked: 46 times
Been thanked: 104 times

Re: Indicator not correct value

Postby bensat » 27 Jul 2016

Tradingest,

is your problem solved now ? Are you able to give any feedback ?

Regards

Ben

tradingest
Posts: 283
Joined: 05 Dec 2014
Location: Italy
Has thanked: 53 times
Been thanked: 3 times

Re: Indicator not correct value

Postby tradingest » 27 Jul 2016

Hi benten,

thanks but I don't know where I wrong.
Sorry. I'm not able to answer because I don't is clear.

You are very kind but in my scanner I continue to see the wrong value e I can't fix it.

tradingest

User avatar
bensat
Posts: 331
Joined: 04 Oct 2014
Has thanked: 46 times
Been thanked: 104 times

Re: Indicator not correct value

Postby bensat » 27 Jul 2016

What value do you expect to see in your scanner. May this makes it much clearer ... Please be aware that you set a condition, in your case <CONDITION20> where the <HIGH> has to be higher than the <HIGHEST(CLOSE,20> of the last 20 bars.

I assume you would like to see the <HIGH> value of the bar in the following screenshot :

Image

So if you can tell us which value you are expecting we might find the solution. I wrote a basic output for you to check which condition was met on every day and if all the conditions to plot <H> was met, it gives you the value. Please check it in the PowerLanguageEditor - Output section.

Image

Code: Select all

// <INPUT> SECTION
input: Price(Close), Length(50);

// [VARIABLES] SECTION
var: DCHi(0), DCLo(0), DCMid(0), BarPercentage(50);
var: OC_Cond(false), HOOC_Cond(false), CLOC_Cond(false), C10(false), C20(false), Plot_Cond(false); // Conditions Check for Debug

DCHi = Highest(Price,Length); // Highest <PRICE> defined for Periot of <LENGTH>
DCLo = Lowest(Price,Length); // Lowest <PRICE> defined for Periot of <LENGTH>
DCMid = (DCHi + DCLo) * 0.5; // Calculate Mid of HPrice (DCHi) & LPrice (DCLo)

// CONDITIONS SECTION
condition10 = (O > C) // OC_Cond
and ((H - O) > (O - C)) // HOOC_Cond
and ((C - L) < (O - C)); // CLOC_Cond

condition20 = (H > DCHi);

// Conditions Debug
if O > C then OC_Cond = true else OC_Cond = false;
if ((H - O) > (O - C)) then HOOC_Cond = true else HOOC_Cond = false;
if ((C - L) < (O - C)) then CLOC_Cond = true else CLOC_Cond = false;
if condition10 then C10 = true else C10 = false;
if condition20 then C20 = true else C20 = false;
if c10 and C20 then Plot_Cond = true else Plot_Cond = false;


If condition10 and condition20 then
begin
Plot1(H, "Hammer");
end;

Plot2(DCHi, "DCHi");
Plot3(DCMid, "DCMid");
Plot4(DCLo, "DCLo");


if Plot_Cond then Print( Date , " - Check Conditions >> " ,
" 1. OC_Cond : ", OC_Cond,
" - 2. HOOC_Cond : ", HOOC_Cond,
" - 3. CLOC_Cond : ", CLOC_Cond,
" / Check Condition10 : ", C10,
" - Check Condition20 : ", C20,
" // MET PLOT CONDITION ??? >> ", Plot_Cond,
">> PlotValue : ", H)
else
Print( Date , " - Check Conditions >> " ,
" 1. OC_Cond : ", OC_Cond,
" - 2. HOOC_Cond : ", HOOC_Cond,
" - 3. CLOC_Cond : ", CLOC_Cond,
" / Check Condition10 : ", C10,
" - Check Condition20 : ", C20,
" // MET PLOT CONDITION ??? >> ", Plot_Cond);
May it helps to understand when your conditions were met and when not. Please give some feedback.

Regards

Ben


Return to “MultiCharts”