NexusFi: Find Your Edge


Home Menu

 





PowerLanguage & EasyLanguage How-To's


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one Gadgetman with 5 posts (1 thanks)
    2. looks_two Big Mike with 3 posts (4 thanks)
    3. looks_3 ccfeldt with 2 posts (1 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
      Best Posters
    1. looks_one lieblm with 3 thanks per post
    2. looks_two Big Mike with 1.3 thanks per post
    3. looks_3 SammyD with 1 thanks per post
    4. looks_4 Gadgetman with 0.2 thanks per post
    1. trending_up 12,071 views
    2. thumb_up 10 thanks given
    3. group 8 followers
    1. forum 14 posts
    2. attach_file 0 attachments




 
Search this Thread

PowerLanguage & EasyLanguage How-To's

  #1 (permalink)
 
Gadgetman's Avatar
 Gadgetman 
Deal, Kent
 
Experience: Advanced
Platform: Multicharts, Metatrader
Trading: GBP/JPY
Posts: 6 since Apr 2010
Thanks Given: 0
Thanks Received: 3

Well for a start I have no idea whether there should be an apostrophe in that title or not - I'm sure any grammar police will help...

As I mentioned in my intro - I'm porting my MT4 strategies over to PowerLanguage (PL), so I can trade MCFX with FXCM. Although I used full EasyLanguage some years ago, the brain cells containing that code died not long after thanks to the necessary alcohol. So I'm learning on the fly as I'm re-writing.

I'm coding with a cut-down version of EL as well as learning so thought I would start this thread as a way of asking questions, calling out the reduced functionality or workarounds in PL and passing on tips as I learn them plus of course it will contain all the useful tips from the experts too (I hope...)

If I've missed another thread somewhere that already does that, great please point it out and I'll close this one.

First question coming in next post!

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
Better Renko Gaps
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Build trailing stop for micro index(s)
Psychology and Money Management
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
59 thanks
Funded Trader platforms
37 thanks
NexusFi site changelog and issues/problem reporting
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
The Program
19 thanks
  #3 (permalink)
 
Gadgetman's Avatar
 Gadgetman 
Deal, Kent
 
Experience: Advanced
Platform: Multicharts, Metatrader
Trading: GBP/JPY
Posts: 6 since Apr 2010
Thanks Given: 0
Thanks Received: 3


In MT4, you can send your order including all info such as take profit, stop loss, slippage etc. all in one command. The take profit is sent as the price you are aiming for.

In EL - it seems to handle take profit differently, with settakeprofit being the actual profit amount you are aiming for, rather than price. Clever, as it obviously does the currency conversion for you, but I'm using a box breakout strategy and the tp is a % of the box range.

Any thoughts on the best approach?
I have an idea I may end up having to monitor the current profit somehow and send a sell or buytocover order when the profit is hit.

Would really appreciate some help on this...

Started this thread Reply With Quote
  #4 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,399 since Jun 2009
Thanks Given: 33,175
Thanks Received: 101,541

I do this in each of my strats:

 
Code
                            
inputs:

  
target1 (20);
  
stoploss (20);
vars:
  
TickSize (MinMove/PriceScale);

SetStopContract;
SetStopLoss((stoploss TickSize) * BigPointValue);
SetProfitTarget((target1 TickSize) * BigPointValue); 
Hope it helps.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #5 (permalink)
 
Gadgetman's Avatar
 Gadgetman 
Deal, Kent
 
Experience: Advanced
Platform: Multicharts, Metatrader
Trading: GBP/JPY
Posts: 6 since Apr 2010
Thanks Given: 0
Thanks Received: 3

Great stuff thanks. Couple of fields there I hadn't read up on yet. Must admit I'm taking the route of not reading the whole reference manual but trying to find solutions as I go along.

Makes complete sense now I see how you've done it. Thanks!

Started this thread Reply With Quote
  #6 (permalink)
 
Gadgetman's Avatar
 Gadgetman 
Deal, Kent
 
Experience: Advanced
Platform: Multicharts, Metatrader
Trading: GBP/JPY
Posts: 6 since Apr 2010
Thanks Given: 0
Thanks Received: 3

Back from a break, raring to go and come across a problem to what should be a very simple piece of code. Tried to find a solution on the web but although problem is recognized, haven't found a solution yet.

I want to calculate the daily range myself, rather than use ATR. It should be a simple case of looking back xx days, deducting low from high for each day and adding to a total.
When all days have been read, dividethe total range for all days by the number of days. Just a few lines of code and done, surely! Ha ha I should know better!

For some reason, if you try adding to the same field within a loop you get weird results with EL.

 
Code
                            
inputsNumberOfDays (3);
variablesadr(0), counter(0), rangetotal(0);

for 
counter 1 to NumberOfDays
begin
    
//Read high and low for each day, calculate range and add to rangetotal
    
rangetotaladr + (high[counter] - low[counter]);
    print (
"Counter = "counter"  high = ",high[counter], "  low = ",low[counter], "  range = ",high[counter] - low[counter],"  rangetotal= ",rangetotal);
end;
//Divide total ranges for all days by number of days and assign to adr
adr rangetotal/NumberofDays;
print(
"adr = ",adr); 
Output from this code is:
HTML Code:
Counter =    1.00  high =  130.22  low =  127.63  range =    2.59  rangetotal= 4505.81
Counter =    2.00  high =  131.36  low =  129.11  range =    2.25  rangetotal= 4508.06
Counter =    3.00  high =  130.80  low =  127.72  range =    3.08  rangetotal= 4511.14
adr = 1503.71
As you can see the range totals are way out, the rangetotal figures should read:
HTML Code:
1:       2.592
2:       4.843 (2.592 + 2.251)
3:       7.920 (4.843 + 3.077)
Unless I'm doing something really stupid, for which I will blush profusely and kick myself, EL is messing up.

I'm sure there's a workaround or alternative way of doing this. Any help would be really appreciated!

Cheers
David

Started this thread Reply With Quote
  #7 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,399 since Jun 2009
Thanks Given: 33,175
Thanks Received: 101,541

You can see that by adding the prior line to the current line you get the right result, so I think it's just your loop that is the problem and your doing the adr math outside the loop.

Why not just add it on top of each other, like you did in the example, something like:

 
Code
                            
rangetotalrangetotal + (high[counter] - low[counter]); 

And get rid of adr altogether.

(untested)

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #8 (permalink)
 
Gadgetman's Avatar
 Gadgetman 
Deal, Kent
 
Experience: Advanced
Platform: Multicharts, Metatrader
Trading: GBP/JPY
Posts: 6 since Apr 2010
Thanks Given: 0
Thanks Received: 3

I guess it would help if I posted the correct code when I had a problem, sorry, I could have sworn I amended that post!
Mike, the actual code does already say rangetotal= rangetotal + (high[counter] - low[counter]);

And it still didn't work.
Initial, I had adr = adr + (high[counter] - low[counter]);
I wondered if using the adr field in the loop, then also using it outside the loop might have been the problem, so I introduced rangetotal within the loop. Didn't help though.

This has been driving me nuts.
But I've finally had the Eureka moment: I wasn't zeroing the adr or rangetotal fields before going back into the loop!

So this code works fine:

 
Code
                            
inputsNumberOfDays (3);
variablesadr(0), counter(0), rangetotal(0);

adr 0;
rangetotal 0;

for 
counter 1 to NumberOfDays
begin
    
//Read high and low for each day and add to rangetotal
    
rangetotal rangetotal + (high[counter]-low[counter]);
    print (
"Counter = "counter"  high = ",high[counter], "  low = ",low[counter], "  rangetotal = ",rangetotal);
end;

//Divide total ranges for all days by number of days and assign to adr
adr rangetotal/NumberofDays;
print(
"adr = ",adr); 

A basic error and pretty worthy of a good blush I think...

Thanks for the response Mike.

Started this thread Reply With Quote
Thanked by:
  #9 (permalink)
 ccfeldt 
Switzerland
 
Experience: Beginner
Platform: MultiCharts, TradeInterceptor
Trading: Forex
Posts: 13 since Mar 2011
Thanks Given: 0
Thanks Received: 1

Hope this is still the place to ask questions about Easy-/PowerLanguage.

I'm looking for information on how to code indicators for the Market Scanner in MultiCharts.
I'd like something that can show the distance to the high/low on whatever resolution the instrument is set to.

Appreciate any help - Cheers!

Reply With Quote
  #10 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,399 since Jun 2009
Thanks Given: 33,175
Thanks Received: 101,541



ccfeldt View Post
Hope this is still the place to ask questions about Easy-/PowerLanguage.

I'm looking for information on how to code indicators for the Market Scanner in MultiCharts.
I'd like something that can show the distance to the high/low on whatever resolution the instrument is set to.

Appreciate any help - Cheers!

I've never tried to do that. You may want to private message @MultiCharts just to confirm its possible and have them point you towards documentation.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote




Last Updated on March 14, 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