Code help

Questions about MultiCharts and user contributed studies.
faraz
Posts: 144
Joined: 25 Feb 2011
Has thanked: 26 times
Been thanked: 57 times

Code help

Postby faraz » 05 Mar 2012

Hi,

I want to create a input in my MC Strategy,

Input: oHL(1);

When i select 1 in the input

1 works for greater then sign ">"
2 works for Less then sign "<"
3 input works for Add "+" sign
4 input works for subtraction "-" sign

and oHL i need to put in the strategy like this.

(High ohl Low)

what is the way to assign oHL = 1 for > then or other signs.

Awaiting

User avatar
furytrader
Posts: 354
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

Re: Code help

Postby furytrader » 05 Mar 2012

I may be a little confused but maybe I can help.

Do you want the user to be able to assign the input setting oHL to the string value of ">" or do you want to be able to assign oHL the numeric value of 1 ... ?

faraz
Posts: 144
Joined: 25 Feb 2011
Has thanked: 26 times
Been thanked: 57 times

Re: Code help

Postby faraz » 06 Mar 2012

I may be a little confused but maybe I can help.

Do you want the user to be able to assign the input setting oHL to the string value of ">" or do you want to be able to assign oHL the numeric value of 1 ... ?

oHL input will be numeric value.
but for each numeric value I want further character assigned like for Numeric "1" input I want Greater than sign ">"

Is it possible?

User avatar
furytrader
Posts: 354
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

Re: Code help

Postby furytrader » 06 Mar 2012

So you want to be able to assign ">1" as an input setting?

That's possible - it's simply a string input (as opposed to a numeric input).

Code: Select all

Input: oHL(">1"); // Or whatever the user puts in here
You would then have to analyze the text string using the built-in PowerLanguage text keywords to identify the individual characters in the string from which to drive your program logic.

If you could explain further what you want to do specifically, I can see what help I can provide.

faraz
Posts: 144
Joined: 25 Feb 2011
Has thanked: 26 times
Been thanked: 57 times

Re: Code help

Postby faraz » 06 Mar 2012

So you want to be able to assign ">1" as an input setting?

That's possible - it's simply a string input (as opposed to a numeric input).

Code: Select all

Input: oHL(">1"); // Or whatever the user puts in here
You would then have to analyze the text string using the built-in PowerLanguage text keywords to identify the individual characters in the string from which to drive your program logic.

If you could explain further what you want to do specifically, I can see what help I can provide.
Thanks for prompt reply.

I want to use the optimizer to run some optimizing tests so I cann't use ">" sign in the input. Input must be numeric only. In code i need some way that if input is 1 then use ">" or if 2 then "<" sign and like that. Is their any way?

User avatar
furytrader
Posts: 354
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

Re: Code help

Postby furytrader » 06 Mar 2012

Like I said, I guess I'm confused - I don't really understand what you're trying to do here. It sounds like you're saying that, based on the numeric input oHL, you want to test different conditions. That's pretty easy:

Code: Select all

Input: oHL(1);

Condition1 = FALSE;

If oHL = 1 Then Condition1 = X > Y;
If oHL = 2 Then Condition1 = X < Y;
...

If Condition1 = TRUE Then ...
I don't understand when you say "+" sign, unless you're referring to Boolean logic.

faraz
Posts: 144
Joined: 25 Feb 2011
Has thanked: 26 times
Been thanked: 57 times

Re: Code help

Postby faraz » 06 Mar 2012

furytrader

Great, Thanks a lot.
Have a great day.


Return to “MultiCharts”