Hello,
i have an Code from Metastock and will bring it to Multicharts 7.0.
Can anyone show me, how i can do it?
I will use it then in the Screener. So when the criteria ok, that an (x) in the Screener and when not than it is empty or an (o).
Many thanks
Kinko
Code Question
- TJ
- Posts: 7745
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2224 times
Re: Code Question
I cannot code it for you, but I can give you some pointers.Hello,
i have an Code from Metastock and will bring it to Multicharts 7.0.
Here is the Code:
If((H>=HHV(H,9)) AND C<Ref(C,-3),1,0)AND If((ADX(14)>25),PDI(14)<(ADX(12)),1)AND If((ADX(14)<25),PDI(14)>(ADX(12)),1)
Can anyone show me, how i can do it?
I will use it then in the Screener. So when the criteria ok, that an (x) in the Screener and when not than it is empty or an (o).
Many thanks
Kinko
First you have to reformat the line into multiple sub-logics, so that you can see what is involved:
Code: Select all
If (( H >= HHV( H, 9 ))
AND C < Ref( C, -3 ), 1, 0)
AND If(( ADX( 14 ) > 25 ), PDI( 14 ) < ( ADX( 12 )), 1 )
AND If(( ADX( 14 ) < 25 ), PDI( 14 ) > ( ADX( 12 )), 1 )
HHV
Ref
ADX
PDI
you have to find out what those are,
then substitute them with the EasyLanguage equivalent.
Next, you have to re-code them in EasyLanguage syntax.
Re: Code Question
Hi Tj,
thanks for your answer,
If (( H >= HHV( H, 9 ))
means
If the Current High is higher than the high for 9 Days.
-----------------------------------------------
AND C < Ref( C, -3 ), 1, 0)
means
Close < Close for 3 Days /// ,1,0 ???
------------------------------------------------
Best regards
Kinko
thanks for your answer,
If (( H >= HHV( H, 9 ))
means
If the Current High is higher than the high for 9 Days.
-----------------------------------------------
AND C < Ref( C, -3 ), 1, 0)
means
Close < Close for 3 Days /// ,1,0 ???
------------------------------------------------
Best regards
Kinko
- TJ
- Posts: 7745
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2224 times
Re: Code Question
look up the following keywords, they might be what you needed:Hi Tj,
thanks for your answer,
If (( H >= HHV( H, 9 ))
means
If the Current High is higher than the high for 9 Days.
-----------------------------------------------
AND C < Ref( C, -3 ), 1, 0)
means
Close < Close for 3 Days /// ,1,0 ???
------------------------------------------------
Best regards
Kinko
Highest
Lowest
Maxlist
Minlist
ps. press the [F1] key will get you the help file.
Re: Code Question
Hello Tj,
my standings for now.
--------------------
So i have convert the first row. Can you tell me, how i can go on?
Best regards
Kinko
my standings for now.
Code: Select all
[LegacyColorValue = TRUE];
inputs:
upcolor(green), dncolor(red), equalcolor(white);
var: color(0),
var0( 0 );
If High > High of 9 bar ago then color=upcolor else If High < High of 9 bar ago then color=dncolor else If High = High of 9 bar ago then color=equalcolor;
Plot1( var0, "S1", black, color ) ;
So i have convert the first row. Can you tell me, how i can go on?
Best regards
Kinko
- TJ
- Posts: 7745
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2224 times
Re: Code Question
Hello Tj,
my standings for now.
[LegacyColorValue = TRUE];
inputs:
upcolor(green), dncolor(red), equalcolor(white);
var: color(0),
var0( 0 );
If High > High of 9 bar ago then color=upcolor else If High < High of 9 bar ago then color=dncolor else If High = High of 9 bar ago then color=equalcolor;
Plot1( var0, "S1", black, color ) ;
--------------------
So i have convert the first row. Can you tell me, how i can go on?
Best regards
Kinko
good start.
1. Please use code tag to wrap the code. It makes reading codes easier.
(I have done it for you in your post. )
2. format your code in multiple lines, so that you can read it and follow the logic.
see my #2 post for example.
3. Read the manual. It teaches you step by step on how to code an indicator. There is no short cut.
4. You are doing fine; go back to post #2 and convert the rest of the code line by line using the same method you have done on your attempt.
Re: Code Question
Hello TJ,
i have an error, but i don´t know why. The Plot in the Screener should be in green, when the ADX of the Value is over 25.
I know my formula is wrong, but what must i change?
Now it only Plot1, but this is not correct. Must i integrate an condition and can you tell me how i can do it?
Best regards
Kinko
i have an error, but i don´t know why. The Plot in the Screener should be in green, when the ADX of the Value is over 25.
I know my formula is wrong, but what must i change?
Now it only Plot1, but this is not correct. Must i integrate an condition and can you tell me how i can do it?
Best regards
Kinko
Code: Select all
[LegacyColorValue = TRUE];
inputs:
upcolor(green), dncolor(red), equalcolor(white),Length( 14 ) ;
var: color(0), var1 (ADX( Length )),
var0( 0 );
If High > High of 9 bar ago
and Close > Close of 3 bar ago
and var1 > 25
then color=upcolor
else If High < High of 9 bar ago then color=dncolor
else If High = High of 9 bar ago then color=equalcolor;
Plot1( var0, "S1", black, color ) ;
- TJ
- Posts: 7745
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2224 times
Re: Code Question
can you post a screenshot of the chart where the color should be green?Hello TJ,
i have an error, but i don´t know why. The Plot in the Screener should be in green, when the ADX of the Value is over 25.
I know my formula is wrong, but what must i change?
Now it only Plot1, but this is not correct. Must i integrate an condition and can you tell me how i can do it?
Best regards
Kinko
Code: Select all
[LegacyColorValue = TRUE];
inputs:
upcolor(green), dncolor(red), equalcolor(white),Length( 14 ) ;
var: color(0), var1 (ADX( Length )),
var0( 0 );
If High > High of 9 bar ago
and Close > Close of 3 bar ago
and var1 > 25
then color=upcolor
else If High < High of 9 bar ago then color=dncolor
else If High = High of 9 bar ago then color=equalcolor;
Plot1( var0, "S1", black, color ) ;
note:
take specific care with the detail of your logic,
High > High of 9 bar ago
means the high of current bar is higher than the high of the 9th bar.
this is different than
the high of current bar is higher than the highest high of all of previous 9 bars.
Re: Code Question
Hello TJ,
Yes, i need the formula for:
"the high of current bar is higher than the highest high of all of previous 9 bars."
Can you show me what the formula is?
I dont have the Indicator in an Chart. I need it in the Screener. When all criteria allright, then i need a info in the Screener.
Many thanks and best regards
Kinko
Yes, i need the formula for:
"the high of current bar is higher than the highest high of all of previous 9 bars."
Can you show me what the formula is?
I dont have the Indicator in an Chart. I need it in the Screener. When all criteria allright, then i need a info in the Screener.
Many thanks and best regards
Kinko
- TJ
- Posts: 7745
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2224 times
Re: Code Question
read post #4Hello TJ,
Yes, i need the formula for:
"the high of current bar is higher than the highest high of all of previous 9 bars."
Can you show me what the formula is?
the devil is in the detail.
I did not post the keywords for no reasons.
you don't need the indicator on the chart, but you should be able to refer to the bar where you think the indicator should trigger the green color.I dont have the Indicator in an Chart. I need it in the Screener. When all criteria allright, then i need a info in the Screener.
Many thanks and best regards
Kinko
I would suggest you to start with an indicator on the chart,
plot a color dot on the chart,
you can then verify whether the color change is exactly where you want the color to change.
When everything is working the way you wanted, then transfer the code to the screener.
Re: Code Question
Hello TJ,
it is an Signal in Metastock and no Indicator. It plot in the Chart only for one Day as an Highlight under the current Candle. So i think it is tricky to build it as an Indicator. What did you mean?
Best regards
Kinko
it is an Signal in Metastock and no Indicator. It plot in the Chart only for one Day as an Highlight under the current Candle. So i think it is tricky to build it as an Indicator. What did you mean?
Best regards
Kinko
- TJ
- Posts: 7745
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2224 times
Re: Code Question
just change this lineHello TJ,
it is an Signal in Metastock and no Indicator. It plot in the Chart only for one Day as an Highlight under the current Candle. So i think it is tricky to build it as an Indicator. What did you mean?
Best regards
Kinko
Plot1( var0, "S1", black, color ) ;
to
Plot1( Close, "S1", color ) ;
and apply it to the main chart.
In the Format Study window (right click n chart)
under the Style tab,
set the Type to Point
and Weight to the thickest line,
and you will see a dot at the closing price.
-
- Posts: 742
- Joined: 09 Apr 2010
- Location: Texas
- Has thanked: 483 times
- Been thanked: 274 times
- Contact:
Re: Code Question
I think this is close : it will plot the colors on the zero line in a subplot, you can use that to verify the code..IF you want the close of the bar colored, then use "Close" in place of "var0" in the plot..
IF you want the colored dot below the price bar then use "L- 3 points" (estimate of points required) instead of "var0". (if you want the close colored or the dot below the Low colored then set the "scaling" to "same as instrument" and "properties" to subchart 1..)
IF you want the colored dot below the price bar then use "L- 3 points" (estimate of points required) instead of "var0". (if you want the close colored or the dot below the Low colored then set the "scaling" to "same as instrument" and "properties" to subchart 1..)
Code: Select all
inputs:upcolor(green),dncolor(red),equalcolor(white),Length(14);
var:color(0),var0(0),var1(0);
var1 = adx(Length);
If H > highest(H[1],9) and Close > Close[3] and var1 > 25 then
color = upcolor else If H < highest(H[1],9) then color=dncolor
else If H = Highest(H[1],9) then color=equalcolor;
Plot1(var0,"S1",color);
Re: Code Question
@TJ and sptrader,
many thanks for your help it runs perfectly. The idea with plot it in the chart at first is good.
Can you help me for the rest of the code?
If((ADX(14)>25),PDI(14)<(ADX(12)),1)AND If((ADX(14)<25),PDI(14)>(ADX(12)),1)
PDI in Metastock = DMI+ in Multicharts
So we can change it in
If((ADX(14)>25),DMI+(14)<(ADX(12)),1)AND If((ADX(14)<25),DMI+(14)>(ADX(12)),1)
Hier is my code today, but the DMI+ will not integrate
Best regards
Kinko
many thanks for your help it runs perfectly. The idea with plot it in the chart at first is good.
Can you help me for the rest of the code?
If((ADX(14)>25),PDI(14)<(ADX(12)),1)AND If((ADX(14)<25),PDI(14)>(ADX(12)),1)
PDI in Metastock = DMI+ in Multicharts
So we can change it in
If((ADX(14)>25),DMI+(14)<(ADX(12)),1)AND If((ADX(14)<25),DMI+(14)>(ADX(12)),1)
Hier is my code today, but the DMI+ will not integrate
Code: Select all
inputs:upcolor(green),dncolor(red),equalcolor(white),Length(14);
var:color(0),var0(0),var1(0),var2(0);
var1 = adx(Length),
var2 = DMI+(Length);
If H > highest(H[1],9) and Close > Close[3] and var1 > 25 then
color = upcolor else If H < highest(H[1],9) then color=dncolor
else If H = Highest(H[1],9) then color=equalcolor;
Plot1(var0,"S1",color);
Kinko
-
- Posts: 742
- Joined: 09 Apr 2010
- Location: Texas
- Has thanked: 483 times
- Been thanked: 274 times
- Contact:
Re: Code Question
This will compile - just add var2 where you want it for dmiplus.
Code: Select all
inputs:upcolor(green),dncolor(red),equalcolor(white),Length(14);
var:color(0),var0(0),var1(0),var2(0);
var1 = adx(Length);
var2 = DMIplus(Length);
If H > highest(H[1],9) and Close > Close[3] and var1 > 25 then
color = upcolor else If H < highest(H[1],9) then color=dncolor
else If H = Highest(H[1],9) then color=equalcolor;
Plot1(var0,"S1",color);
Re: Code Question
@sptrader,
wonderful, many thanks.
The criteria should be fulfilled only when the ADX 14> 25 and at the same time DMIplus 14 <ADX 12
Can you help me there, maybe get the rest I can do alone.
So it looks like in Metastock
If((ADX(14)>25),PDI(14)<(ADX(12)
Can you tell me how it is in Multicharts?
Best regards
Kinko
wonderful, many thanks.
The criteria should be fulfilled only when the ADX 14> 25 and at the same time DMIplus 14 <ADX 12
Can you help me there, maybe get the rest I can do alone.
So it looks like in Metastock
If((ADX(14)>25),PDI(14)<(ADX(12)
Can you tell me how it is in Multicharts?
Best regards
Kinko
-
- Posts: 742
- Joined: 09 Apr 2010
- Location: Texas
- Has thanked: 483 times
- Been thanked: 274 times
- Contact:
Re: Code Question
var1 = adx(14);
var2 = DMIplus(14);
Var3 = adx(12);
var1 is your adx14 and var2 is your DmiPlus14 and var3 is your adx12, so you just say-
if var1 > 25 and var2 < var3
var2 = DMIplus(14);
Var3 = adx(12);
var1 is your adx14 and var2 is your DmiPlus14 and var3 is your adx12, so you just say-
if var1 > 25 and var2 < var3
-
- Posts: 742
- Joined: 09 Apr 2010
- Location: Texas
- Has thanked: 483 times
- Been thanked: 274 times
- Contact:
Re: Code Question
***************************************************************************@sptrader,
super, now i have 0,00 in the Screener, can you tell me, how i integrate a Counter?
The other things work now perfect, many thanks.
Best regards
Kinko
** I'm not a programmer, so it's best to look at other code examples(in MC) that have counters in them or look in the help section under "counters" or get a good easylanguage book, that's how I figure things out, but I rarely use counters, so you need a good programmer to handle that. sorry.
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Code Question
I'm not sure what you want to count, but the following is a simple Counter example:super, now i have 0,00 in the Screener, can you tell me, how i integrate a Counter?
Code: Select all
Variables:
IntraBarPersist MyCounter(0);
// Count all the ticks happening above the
// previous bar high
if (Close > High[1]) then
MyCounter = MyCounter + 1;
// On bar close: plot the counter value in the
// data window, and reset the counter so we can
// start counting from fresh in the next bar
if (BarStatus(1) = 2) then begin
Plot1(MyCounter, "MyCounter");
MyCounter = 0;
end;