ChangeParameters()

Section for discussions related to indicators, use of indicators, and building of trading stategies using indicators.

Moderator: admin

ChangeParameters()

Postby MrRiversideDude » Sun Aug 30, 2015 9:22 pm

My strategy has these parameters:

strategy.parameters:addBoolean("AllowTrade", "Allow strategy to trade", "", true);
strategy.parameters:setFlag("AllowTrade", core.FLAG_ALLOW_TRADE);
strategy.parameters:addString("AllowedSide", "Allowed side", "Allow Sell or Buy", "None");
strategy.parameters:addStringAlternative("AllowedSide", "None", "", "None");
strategy.parameters:addStringAlternative("AllowedSide", "Buy", "", "Buy");
strategy.parameters:addStringAlternative("AllowedSide", "Sell", "", "Sell");

Once a position has been opened I want to reset them using the ChangeParameters() function:
I'm not sure of the syntax and when I can call it even after reading the documentation.

function ChangeParameters()
-- Trading parameters
AllowedSide = instance.parameters.AllowedSide;
AllowedTrade = instance.parameters.AllowedTrade;

local name = profile:id() .. " (" .. mode .. " | " .. Strategy .. ")";
end

Thanks in advance.
MrRiversideDude
 
Posts: 87
Joined: Fri Feb 21, 2014 7:50 am

Re: ChangeParameters()

Postby Victor.Tereschenko » Fri Sep 11, 2015 5:59 am

You don't need to call ChangeParameters(), it's called by the Marketscope when a user changes parameters of the strategy. Why do you need to change parameters?
“There are only three sports: bullfighting, motor racing, and mountaineering; all the rest are merely games.” (c) Ernest Hemingway
Victor.Tereschenko
FXCodeBase: Confirmed User
 
Posts: 144
Joined: Fri Nov 19, 2010 8:55 am


Return to Discussions

Who is online

Users browsing this forum: No registered users and 7 guests