NexusFi: Find Your Edge


Home Menu

 





Help, Tradestation code cannot compile in MC


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one Bimi with 3 posts (5 thanks)
    2. looks_two mwkl2011 with 3 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 sptrader with 1 posts (2 thanks)
    1. trending_up 2,442 views
    2. thumb_up 7 thanks given
    3. group 3 followers
    1. forum 7 posts
    2. attach_file 1 attachments




 
Search this Thread

Help, Tradestation code cannot compile in MC

(login for full post details)
  #1 (permalink)
mwkl2011
Hong Kong
 
Posts: 3 since Jul 2012
Thanks Given: 4
Thanks Received: 0

I got a TS RC Beginner strategy and want to do the back test in MC but it just won't compile in MC.
Do I need to make some code conversion?
If yes where can I find like conversion table?
The TS code are as follows, thanks

Inputs:
PriceES(Close of Data1),
PriceNDQ(Close of Data2);
Vars: StopLoss(12), Stop_Width(0), Stop_Price(0);
Vars: StartTimeMins(0), EndTimeMins(0), LastTradeMins(0), Tmins(0);
if CurrentBar=1 then
begin
StartTimeMins = TimeToMinutes(Sess1StartTime)+40; //09:10
LastTradeMins = TimeToMinutes(Sess1EndTime)-25; //14:50
EndTimeMins = TimeToMinutes(Sess1EndTime)-15; //15:00
end;
Tmins = TimeToMinutes (Time);
Vars: ESYDC(0), NDQYDC(0), Started(FALSE);
Vars: ESLevel(0), NDQLevel(0);
if Date<>Date[1] then
begin
ESYDC = PriceES[1];
NDQYDC = PriceNDQ[1];
Started = TRUE;
end;
if Started then
begin
ESLevel = Close-ESYDC;
NDQLevel = PriceNDQ-NDQYDC;
end;
Vars: Priority(false), NDQ(0), NoTrade(false);
Vars: Trade1(false), Trade3(false), Trade4(false), Trade5(false);
Vars: Trade6(false), Trade8(false), Trade9(false), Trade10(false);
if Date<>Date[1] then
begin
Priority = false;
NoTrade = false;
Trade1 = false;
Trade3 = false;
Trade4 = false;
Trade5 = false;
Trade6 = false;
Trade8 = false;
Trade9 = false;
Trade10 = false;
end;
if Tmins = StartTimeMins then
begin
{condition 1}
if ESLevel >= 0 and ESLevel < 10 and NDQLevel >= 0 and NDQLevel
< 10 and NDQLevel >= ESLevel then Trade1 = true
{condition 2}
else if ESLevel >= 0 and ESLevel < 10 and NDQLevel >= 0 and
NDQLevel < 10 and ESLevel > NDQLevel then NoTrade = true
{condition 3}
else if ESLevel < 0 and ESLevel > -10 and NDQLevel < 0 and
NDQLevel > -10 and NDQLevel <= ESLevel then Trade3 = true
{condition 4}
else if ESLevel < 0 and ESLevel > -10 and NDQLevel < 0 and
NDQLevel > -10 and ESLevel < NDQLevel then
begin
Sell Short(“Short 4”)this bar on close;
Priority = true;
Stop_Width = StopLoss;
end
{condition 5}
else if ESLevel >= 0 and ESLevel < 10 and NDQLevel < 0 and
NDQLevel > -10 then Trade5 = true
{condition 6}
else if ESLevel < 0 and ESLevel > -10 and NDQLevel >= 0 and
NDQLevel < 10 then Trade6 = true
{condition 7}
else if ESLevel < 0 and ESLevel > -10 and NDQLevel <= -10 then
NoTrade = true
{condition 8}
else if ESLevel >= 0 and ESLevel < 10 and NDQLevel >= 10 then
begin
NDQ = NDQLevel;
Trade8 = true;
End
{condition 9}
else if ESLevel <= -10 and NDQLevel <= -10 then
begin
NDQ = NDQLevel;
Trade9 = true;
End
{condition 10}
else if ESLevel >= 10 and NDQLevel >= 10 then
begin
NDQ = NDQLevel;
Trade10 = true;
end;
end;
if Tmins >= StartTimeMins and Tmins <= LastTradeMins and
Priority = false then
begin
{condition 1}
if NDQLevel <= -13 and Trade1 then
begin
Sell Short(“Short 1”)this bar on close;
Trade1 = false;
Priority = true;
Stop_Width = StopLoss;
end;
{condition 2 = No Trade}
{condition 3}
if NDQLevel <= -13 and Trade3 then
begin
Sell Short(“Short 3”)this bar on close;
Trade3 = false;
Priority = true;
Stop_Width = StopLoss;
end;
{condition 5}
if ESLevel >= 2 and NDQLevel >= 13 and Trade5 then
begin
Buy(“Long 5”)this bar on close;
Trade5 = false;
Priority = true;
Stop_Width = StopLoss;
end;
{condition 6}
if ESLevel <= -2 and NDQLevel <= -13 and Trade6 then
begin
Sell Short(“Short 6”)this bar on close;
Trade6 = false;
Priority = true;
Stop_Width = StopLoss;
end;
{condition 7 = No Trade}
{condition 8}
if NDQLevel-NDQ >= 10 and Trade8 then
begin
Buy(“Long 8”)this bar on close;
Trade8 = false;
Priority = true;
Stop_Width = StopLoss;
end;
{condition 9}
if NDQ-NDQLevel >= 10 and Trade9 then
begin
Sell Short(“Short 9”)this bar on close;
Trade9 = false;
Priority = true;
Stop_Width = StopLoss;
end;
{condition 10}
if NDQLevel-NDQ >= 10 and Trade10 then
begin
Buy(“Long 10”)this bar on close;
Trade10 = false;
Priority = true;
Stop_Width = StopLoss;
end;
end;
if MarketPosition = 1 then
begin
Stop_Price = EntryPrice - Stop_Width;
Sell (“L-Exit”) next bar Stop_Price Stop;
end;
if MarketPosition = -1 then
begin
Stop_Price = EntryPrice + Stop_Width;
buy to cover (“S-Exit”) next bar Stop_Price
Stop;
end;
if Tmins >= EndTimeMins then
begin
Sell(“Long Close”) this bar on close;
Buy to Cover(“Short Close”) this bar on close;
end;

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trader Dale [email protected] or Scammer Dale
Trading Reviews and Vendors
Volume profile TradeStation
EasyLanguage Programming
Request for MACD with option to use different MAs for fa …
NinjaTrader
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
GFIs1 1 DAX trade per day journal
28 thanks
Supertradersams Thread Journal on NQ/MNQ
26 thanks
Tao te Trade: way of the WLD
24 thanks
Just another trading journal: PA, Wyckoff & Trends
12 thanks
1% Risk Journal
11 thanks

(login for full post details)
  #3 (permalink)
Bimi
London
 
Posts: 118 since Mar 2010
Thanks Given: 42
Thanks Received: 58


don't just say "won't compile in MC.".

why?
what was the error message?

please copy and paste it here.



ps. learn to use code tag.

Reply With Quote
(login for full post details)
  #4 (permalink)
 
sptrader's Avatar
 sptrader 
Colorado
 
Experience: Advanced
Platform: MultiCharts
Broker: IB & Iqfeed
Trading: ES , CL
Posts: 535 since Apr 2010
Thanks Given: 1,097
Thanks Received: 701

try this- attachment..
the problem was with the formatting around the strings "short-1" etc and "Long-1" etc..

Attached Files
Register to download File Type: pla _MC TS Code.pla (12.1 KB, 16 views)
Reply With Quote
The following 2 users say Thank You to sptrader for this post:
(login for full post details)
  #5 (permalink)
mwkl2011
Hong Kong
 
Posts: 3 since Jul 2012
Thanks Given: 4
Thanks Received: 0

Thank you Sp & Bimi.

SPtarder, you file work, I can compile it now, thanks.

Bimi, what do you mean by 'learn to use code tag'?
When I compile the file an error message shown:

------ Compiled with error(s): ------
incorrect input type
errLine 2, errColumn 8, errLineEnd 2, errColumnEnd 22
causal study: (Function)

and it seems point to the first sentence "PriceES(Close of Data1)," so I tried to change it but to no avail.
Sorry I'm a newbie at the very beginning to try to use it (without programing background). Thanks both of you.

Reply With Quote
(login for full post details)
  #6 (permalink)
mwkl2011
Hong Kong
 
Posts: 3 since Jul 2012
Thanks Given: 4
Thanks Received: 0

A question arise here,

Inputs:
PriceES(Close of Data1),
PriceNDQ(Close of data2);

if I change it to

Inputs:
PriceES(CloseD of Data1),
PriceNDQ(CloseD of data2);

or

Inputs:
PriceES(prevClose of Data1),
PriceNDQ(prevClose of data2);

what's the difference between the above cases?
Thanks.

Reply With Quote
(login for full post details)
  #7 (permalink)
Bimi
London
 
Posts: 118 since Mar 2010
Thanks Given: 42
Thanks Received: 58


mwkl2011 View Post
Thank you Sp & Bimi.

SPtarder, you file work, I can compile it now, thanks.

Bimi, what do you mean by 'learn to use code tag'?
When I compile the file an error message shown:

------ Compiled with error(s): ------
incorrect input type
errLine 2, errColumn 8, errLineEnd 2, errColumnEnd 22
causal study: (Function)

and it seems point to the first sentence "PriceES(Close of Data1)," so I tried to change it but to no avail.
Sorry I'm a newbie at the very beginning to try to use it (without programing background). Thanks both of you.

no problem, we all started as a beginner.

it is important to include error messages when asking for help, so that people do not have to do the investigation from square one.

code tag is the icon at the top of the message window.

tagged codes look like this:

 
Code
Inputs:
PriceES(Close of Data1),
PriceNDQ(Close of data2);

Reply With Quote
(login for full post details)
  #8 (permalink)
Bimi
London
 
Posts: 118 since Mar 2010
Thanks Given: 42
Thanks Received: 58


mwkl2011 View Post
A question arise here,

 
Code
Inputs:
PriceES(Close of Data1),
PriceNDQ(Close of data2);
refers to the close of each bar.

 
Code
Inputs:
PriceES(CloseD of Data1),
PriceNDQ(CloseD of data2);
refers to the close of each day on an intraday chart.
closeD will scan the whole day and pick out the closing price of the day.

 
Code
Inputs:
PriceES(prevClose of Data1),
PriceNDQ(prevClose of data2);
don't know about this one.

Reply With Quote





Last Updated on July 20, 2012


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts