Hello,
I made a small adjustment to the MA Advisor. I used the editor and changed what I wanted to change and renamed the file, since I don´t want to have a conflict with the original which I use, too. I run it through the strategy debugger, then I copied the file in the folder of strategies/standard. Do I need to compile or can I just copy the file? When trying to open the strategy in the marketscope, the message -- try to attempt nil to a global index -- appeared and I couldn´t load the file to my strategies. Do I have do make a copy of the RC file and give it the same name as I have used for the adjusted strategy? How do I make small changes to an existing program properly?
What I wanted to achieve was, when I use both sides to trade (long and short), that the opposite trade doesn´t not close the trade before. E.g. the MVA opens a long trade and then a short, in this instance the long trade is automatically closed. I don´t want this to happen. Therefore, I removed under the -- buy condition met -- in the code, the line " close ("S") -- closes all existing shorts --, and under -- sell condition met -- the line close ("B") -- closes all existing longs. Can you help me out?
Thanks
Here the extract of code I tried to change:
-- buy condition met (fast crosses over slow)
if CANTRADE then
close("S"); -- closes all existing shorts on the account enter("B"); -- and the enter long
end
terminal:alertMessage(TICKSRC:instrument(), TICKSRC[NOW], name .. ":" .. BUY, TICKSRC:date(NOW));
if PLAY then
terminal:alertSound(SOUND, RECURRENTSOUND);
end
if SENDEMAIL then
terminal:alertEmail(EMAIL, name .. ":" .. BUY, FormatEmail(TICKSRC, NOW, BUY));
end
elseif core.crossesUnder(FMADATA, SMADATA, p - FMASHIFT, p - SMASHIFT) and (ALLOWEDSIDE == "Both" or ALLOWEDSIDE == "Sell") then
-- sell condition met (slow crosses over fast)
if CANTRADE then
close("B"); -- closes all existing longs on the account enter("S"); -- and the enter short
end