Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 4/30/2005(UTC) Posts: 13
|
Is there any way in Expert Advisor (perhaps a feature addon that I'm not aware of) to assign values to a variable name that can be referenced by name in multiple statements, as is done with "Input" in MetaStock formulas?
For example, in one Expert Advisor I use the same value of days to option expiration in 24 different statements. I'm required in edit mode to manually enter the numeric value as part of the statement algorithm 24 times each time the value changes (every day).
I do it, but it's tedious. It would be infinitely easier to simply assign a value to a variable name once and then reference that name in coding as needed.
Thank you,
Andrew McDonald
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Unverified Users Joined: 7/12/2007(UTC) Posts: 134 Location: Perth Western Australia
|
Hi Andrew,
The solution proposed uses an existing MetaStock function and would only require changing the Option Expiry Date monthly rather than changing the Days to Expiry on a daily basis.
Create a new indicator as follows:-
[Name] ExpiryDays [Name]
[Code] Life(101218) {Next Expiry Date = (yymmdd)} [Code]
Instead of using the Input function replace with:-
[Code] Fml("ExpiryDays") [Code]
Hopefully this will save you some time.
oz
|
|
|
|
Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 4/30/2005(UTC) Posts: 13
|
oz,
Thanks much for your solution. It's up and running and saves me a bunch of time.
Andrew
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.