NexusFi: Find Your Edge


Home Menu

 





Noob alert! Query regarding entering variable


Discussion in MultiCharts

Updated
    1. trending_up 3,335 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 14 posts
    2. attach_file 2 attachments




 
Search this Thread

Noob alert! Query regarding entering variable

  #1 (permalink)
 saj1011 
London, United Kingdom
 
Experience: Intermediate
Platform: MetaTrader
Trading: EUR/USD
Posts: 20 since Feb 2014
Thanks Given: 2
Thanks Received: 4

Hi,

in Big Mike's video:



about teaching EL (which i just went through), he says that the variable "Ticksize" is not standard with MC.
I tried compiling the script and got an error highlighting that line of code of course. So, how do I get the ticksize variable in MC?

Thanks

Attached Thumbnails
Click image for larger version

Name:	mc non compile error.jpg
Views:	194
Size:	15.2 KB
ID:	141707  
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trade idea based off three indicators.
Traders Hideout
How to apply profiles
Traders Hideout
Increase in trading performance by 75%
The Elite Circle
MC PL editor upgrade
MultiCharts
Better Renko Gaps
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
35 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
19 thanks
GFIs1 1 DAX trade per day journal
16 thanks
Spoo-nalysis ES e-mini futures S&P 500
14 thanks
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

saj1011,

what is the exact error message you are getting? Although ticksize is a function now, it compiles fine here as a variable. The image from your code looks you declared the variable ticksize fine, that's why the error message would be helpful in tracking the issue down. Also include the exact version of your MC.

You can also try a code with only this
 
Code
vars: ticksize (minmove/pricescale);
Does it compile? If not, does it compile if you change it to
 
Code
vars: vticksize (minmove/pricescale);
Regards,
ABCTG

Follow me on Twitter Reply With Quote
  #3 (permalink)
 saj1011 
London, United Kingdom
 
Experience: Intermediate
Platform: MetaTrader
Trading: EUR/USD
Posts: 20 since Feb 2014
Thanks Given: 2
Thanks Received: 4


error is this from original "Ticksize" code:

------ Build started: ------
Study: "futures.io (formerly BMT)_MoneyMaker" (Signal)
Please wait ....
------ Compiled with error(s): ------
'(' Expected
line 12, column 4

with "vticksize" same error:

------ Build started: ------
Study: "futures.io (formerly BMT)_MoneyMaker" (Signal)
Please wait ....
------ Compiled with error(s): ------
'(' Expected
line 12, column 4

Also, I noticed you removed the spaces ( MinMove / PriceScale ), to (MinMove / PriceScale), is this significant or just a matter or neatness?

as it happens line 12 is the row with "vars" on it

what is difference between vticksize and ticksize?

why also is the word Ticksize purple when typed? is this because my version of MC is old/needs updated as you say it is now included?
Also, when i type in vticksize it is greyed out like the other variables.
when it is purple does that mean it is ok or not?

Apologies for noob questions!

version 3.0 powerlanguage, product 8.8.8593.400


Thanks

Started this thread Reply With Quote
  #4 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

saj1011,

please post the full code in here, the error you are getting is not related to ticksize.




saj1011 View Post
error is this from original "Ticksize" code:

Also, I noticed you removed the spaces ( MinMove / PriceScale ), to (MinMove / PriceScale), is this significant or just a matter or neatness?

Just neatness.


what is difference between vticksize and ticksize?

No difference in general, but MC has a function that is called ticksize, that's why the word ticksize is purple. This shouldn't make any issues though.

Regards,
ABCTG

Follow me on Twitter Reply With Quote
  #5 (permalink)
 saj1011 
London, United Kingdom
 
Experience: Intermediate
Platform: MetaTrader
Trading: EUR/USD
Posts: 20 since Feb 2014
Thanks Given: 2
Thanks Received: 4

this is the whole compile error

------ Build started: ------
Study: "futures.io (formerly BMT)_MoneyMaker" (Signal)
Please wait ....
------ Compiled with error(s): ------
'(' Expected
line 12, column 4





fyi: mc version MultiCharts64 Version 8.8 Release (Build 8593)

Started this thread Reply With Quote
  #6 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

saj1011,

I need to see the exact PowerLanguage code to be able to help, meaning the code that produces the error on your end. Can you post this?

Regards,
ABCTG

Follow me on Twitter Reply With Quote
  #7 (permalink)
 saj1011 
London, United Kingdom
 
Experience: Intermediate
Platform: MetaTrader
Trading: EUR/USD
Posts: 20 since Feb 2014
Thanks Given: 2
Thanks Received: 4

(same code as BM posted in his thread about learning EL code with vdieo)

inputs:
smalength (200),
emalength (100),
hmalength (34),
target1 (12),
target2 (12),
target3 (20),
stopsize (12),
BE2 (0), // 0=false, 1=true
BE3 (0), // 0=false, 1=true

vars:
ticksize ( MinMove / PriceScale ),
smav (0),
emav (0),
hmav (0),
t1 ( Target1 * TickSize ),
t2 ( (Target1 + Target2) * TickSize ),
t3 ( (Target1 + Target2 + Target3) * TickSize ),
st1 ( 0 ),
st2 ( 0 ),
st3 ( 0 );

smav = Average(Close, smalength);
emav = XAverage(Close, emalength);
hmav = jtHMA(Close, hmalength);


// open new positions

if MarketPosition = 0 then begin

if smav > smav[1] and emav > emav[1] and hmav > hmav[1] then begin

Buy ("Enter long") 3 Contracts Next Bar At Market;
end;

if smav < smav[1] and emav < emav[1] and hmav < hmav[1] then begin

SellShort ("Enter short") 3 Contracts Next Bar At Market;
end;

end;

// manage open orders

if MarketPosition = 1 then begin

st1 = EntryPrice - (stopsize * TickSize);
st2 = iff(BE2 = 1, EntryPrice, EntryPrice - (stopsize * TickSize));
st3 = iff(BE3 = 1, EntryPrice, EntryPrice - (stopsize * TickSize));

if CurrentContracts = 1 then begin
Sell ("Exit l3-c1 Target") 1 Contracts Next Bar At (EntryPrice + t3) Limit;
Sell ("Exit l3-c1 Stop") 1 Contracts Next Bar At st3 Stop;
end;

if CurrentContracts = 2 then begin
Sell ("Exit l2-c2 Target") 1 Contracts Next Bar At (EntryPrice + t2) Limit;
Sell ("Exit l2-c2 Stop") 1 Contracts Next Bar At st2 Stop;
Sell ("Exit l3-c2 Target") 1 Contracts Next Bar At (EntryPrice + t3) Limit;
Sell ("Exit l3-c2 Stop") 1 Contracts Next Bar At st3 Stop;
end;

if CurrentContracts = 3 then begin
Sell ("Exit l1-c3 Target") 1 Contracts Next Bar At (EntryPrice + t1) Limit;
Sell ("Exit l1-c3 Stop") 1 Contracts Next Bar At st1 Stop;
Sell ("Exit l2-c3 Target") 1 Contracts Next Bar At (EntryPrice + t2) Limit;
Sell ("Exit l2-c3 Stop") 1 Contracts Next Bar At st2 Stop;
Sell ("Exit l3-c3 Target") 1 Contracts Next Bar At (EntryPrice + t3) Limit;
Sell ("Exit l3-c3 Stop") 1 Contracts Next Bar At st3 Stop;
end;

end;

if MarketPosition = -1 then begin

st1 = EntryPrice + (stopsize * TickSize);
st2 = iff(BE2 = 1, EntryPrice, EntryPrice + (stopsize * TickSize));
st3 = iff(BE3 = 1, EntryPrice, EntryPrice + (stopsize * TickSize));

if CurrentContracts = 1 then begin
BuyToCover ("Exit s3-c1 Target") 1 Contracts Next Bar At (EntryPrice - t3) Limit;
BuyToCover ("Exit s3-c1 Stop") 1 Contracts Next Bar At st3 Stop;
end;

if CurrentContracts = 2 then begin
BuyToCover ("Exit s2-c2 Target") 1 Contracts Next Bar At (EntryPrice - t2) Limit;
BuyToCover ("Exit s2-c2 Stop") 1 Contracts Next Bar At st2 Stop;
BuyToCover ("Exit s3-c2 Target") 1 Contracts Next Bar At (EntryPrice - t3) Limit;
BuyToCover ("Exit s3-c2 Stop") 1 Contracts Next Bar At st3 Stop;
end;

if CurrentContracts = 3 then begin
BuyToCover ("Exit s1-c3 Target") 1 Contracts Next Bar At (EntryPrice - t1) Limit;
BuyToCover ("Exit s1-c3 Stop") 1 Contracts Next Bar At st1 Stop;
BuyToCover ("Exit s2-c3 Target") 1 Contracts Next Bar At (EntryPrice - t2) Limit;
BuyToCover ("Exit s2-c3 Stop") 1 Contracts Next Bar At st2 Stop;
BuyToCover ("Exit s3-c3 Target") 1 Contracts Next Bar At (EntryPrice - t3) Limit;
BuyToCover ("Exit s3-c3 Stop") 1 Contracts Next Bar At st3 Stop;
end;
end;

Started this thread Reply With Quote
  #8 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

saj1011,

you are missing a ; in your code. Change your code from this
 
Code
BE3 (0), // 0=false, 1=true

vars:
ticksize ( MinMove / PriceScale ),
to this
 
Code
BE3 (0); // 0=false, 1=true

vars:
ticksize ( MinMove / PriceScale ),
The comma at the end of line 10 needs to be a semicolon. This will compile your code fine.

Regards,
ABCTG

Follow me on Twitter Reply With Quote
  #9 (permalink)
 saj1011 
London, United Kingdom
 
Experience: Intermediate
Platform: MetaTrader
Trading: EUR/USD
Posts: 20 since Feb 2014
Thanks Given: 2
Thanks Received: 4

Ok, thanks a million!

I thought it was because it had purpled out the word ticksize vs the other variables that were grey.
why did it make it purple?

Started this thread Reply With Quote
  #10 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627


You are welcome. I answered it here:
purple = function

Regards,
ABCTG

Follow me on Twitter Reply With Quote
Thanked by:




Last Updated on April 3, 2014


© 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