Easy Language Compatibility

Questions about MultiCharts and user contributed studies.
tornadoatc
Posts: 11
Joined: 05 Feb 2011
Been thanked: 1 time

Easy Language Compatibility

Postby tornadoatc » 23 Oct 2011

Hello,

I thought that Multicharts was EasyLanguage compatible???

I have a strategy that works fine in TS but when I import into MC 9.0 i am getting error stating "Orders can not be inside a loop"..

Code: Select all

FOR Value1=1 to LegCnt BEGIN
If didTrg1stFire[Value1] THEN BEGIN // TRADE MANAGER ONLY EXECUTES NAMED ORDERS ONCE
SWITCH (Value1) BEGIN
CASE 1:
Sell ("LX-Mo1-Trg1") Next Bar Trg1stPosSizeArray[1] Contracts From Entry ("LE-Mo1") at Market;
IF vDebugLvl>=1 AND Not_Optimizing THEN print(File("c:\TSLog.txt"), Date_String," ", Time:4:0,
" EXIT WITH TGT 1 NEXT BAR MARKET ");
CASE 2:
Sell ("LX-Mo1-Trg2") Next Bar Trg1stPosSizeArray[2] Contracts From Entry ("LE-BM1-2") at Market;
IF vDebugLvl>=1 AND Not_Optimizing THEN print(File("c:\TSLog.txt"), Date_String," ", Time:4:0,
" EXIT WITH TGT 1 NEXT BAR MARKET ");
This works in TS and enables me to manage all entries with similar stop logic.

Why doesn't this work in MC? I don't want to have to recode strategies that work in TS.

Thanks,
ATC

tekram
Posts: 96
Joined: 26 May 2009
Has thanked: 6 times
Been thanked: 18 times

Re: Easy Language Compatibility

Postby tekram » 24 Oct 2011

Where did you get MC 9.0 ?
The sell inside a loop is undocumented in TS, but buy and sell short will generate error #204. Generally undocumented features in TS will not be replicated in MC.

TS Help:
204 "Orders cannot be inside a loop."

EasyLanguage does not allow trading orders to be placed inside a For or While loop. If the intention of placing an order inside a loop is to increase the number of shares or contracts that the strategy will handle, this can still be done by placing the calculation of the number of shares or contracts inside a loop and then using the resulting value in the order instruc tion after the loop is finished. For example,

While Condition1 Begin
Value1 = {calculation of number of shares};
End;

Buy Value1 Shares Next Bar at Market;
Hello,
I thought that Multicharts was EasyLanguage compatible???

I have a strategy that works fine in TS but when I import into MC 9.0 i am getting error stating "Orders can not be inside a loop"....
Thanks,
ATC


Return to “MultiCharts”