Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
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!
Can you help answer these questions from other members on NexusFi?
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.
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!
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.
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:
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:
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:
A basic error and pretty worthy of a good blush I think...
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.