Another Coding Question

Questions about MultiCharts and user contributed studies.
canaussieuck
Posts: 25
Joined: 13 Mar 2012
Has thanked: 2 times

Another Coding Question

Postby canaussieuck » 04 Apr 2012

I think its obvious what I'm trying to do here, but i can't get it compiled...could you please give me a hand? Its old Easy Language...

If Open next bar > high this
bar or open of next bar < low of
this bar then buy next bar at
close of this bar + range
of the bar on stop;

if open of next bar < low of this bar
or open of next bar > high of this bar then
sellshort next bar at close of this bar - Range
of this bar stop;

exit long next bar at market
exit short next bar at market

sptrader
Posts: 742
Joined: 09 Apr 2010
Location: Texas
Has thanked: 483 times
Been thanked: 274 times
Contact:

Re: Another Coding Question

Postby sptrader » 04 Apr 2012

try this:

Code: Select all

If Open of next bar > high of this bar or
open of next bar < low of this bar then
buy next bar at close + range stop;

if open of next bar < low of this bar or
open of next bar > high of this bar then
sellshort next bar at close - Range stop;

sell next bar at market;
buytocover next bar at market;

canaussieuck
Posts: 25
Joined: 13 Mar 2012
Has thanked: 2 times

Re: Another Coding Question

Postby canaussieuck » 04 Apr 2012

Cheers for that....is there anything in particular that i need to be looking out for when copying old EL to PowerLanguage?

Cheers,


CanOz

sptrader
Posts: 742
Joined: 09 Apr 2010
Location: Texas
Has thanked: 483 times
Been thanked: 274 times
Contact:

Re: Another Coding Question

Postby sptrader » 04 Apr 2012

PowerLanguage is about 99% the same as Easylanguage, you shouldn't have much trouble..
I always check the "View" output" in the PowerEditor page, when I get stuck- it tells what the error is and you can usually figure out how to correct it from there.
I used Easylanguage for 15 years or so, before coming to PowerLanguage and I rarely run into anything much different. (I'm not a pro programmer)..
Another way to learn, is to open some of the studies in the PowerEditor and see how they are coded.
* Old EL studies can be imported directly into the PowerEditor and will usually do the conversion for you.

canaussieuck
Posts: 25
Joined: 13 Mar 2012
Has thanked: 2 times

Re: Another Coding Question

Postby canaussieuck » 11 Apr 2012

Thanks SP trader.

I'm working my way through the learning curve now.

I coded up a 'popgun' style pattern as a show me study and found two patterns like this one. They don't occur all the often on a 15 minute chart of the DAX but i would like to test it out on more data.

Can someone suggest the best way to code this pattern? Its basically an inside bar/candle followed by an outside bar, but the key is that its a reversal, the inside bar must be close to a doji or at least a spinning top, with a narrow range. Then the next bar attempts to break higher but then reverses. Also, both instances saw the volume of the last bar nearly double that of the inside bar.

Please see the attached screenshot.

Thanks,


CanOz
Attachments
inside bar reversal.GIF
(7.49 KiB) Downloaded 344 times

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Another Coding Question

Postby TJ » 11 Apr 2012

Thanks SP trader.

I'm working my way through the learning curve now.

I coded up a 'popgun' style pattern as a show me study and found two patterns like this one. They don't occur all the often on a 15 minute chart of the DAX but i would like to test it out on more data.

Can someone suggest the best way to code this pattern? Its basically an inside bar/candle followed by an outside bar, but the key is that its a reversal, the inside bar must be close to a doji or at least a spinning top, with a narrow range. Then the next bar attempts to break higher but then reverses. Also, both instances saw the volume of the last bar nearly double that of the inside bar.

Please see the attached screenshot.

Thanks,


CanOz
the best way to start coding:

1. write out your thoughts one line at a time
2. write out the analysis one line at a time

ie. do not write a paragraph;
write your thoughts in sentences,
one sentence at a time,
and one line per sentence.

think like a computer -- the computer reads your code (your thoughts) one line at a time.
act like a computer -- the computer executes your code (your instructions) one line at a time.

be as descriptive as you can,
write out all the characteristics in detail.
Hint: What you have written above is NOT detail enough.
You can easily add another 5~6 attributes to the pattern.

canaussieuck
Posts: 25
Joined: 13 Mar 2012
Has thanked: 2 times

Re: Another Coding Question

Postby canaussieuck » 16 Apr 2012

Thanks TJ.

QUESTION...what is the proper way to code a daily gap up if the daily chart is data2? I can code it when the daily chart is data1, but for my study and strat I need data1 to be a 1 minute chart of the index for the entry and the daily chart to be the first condition, the gap up. In this case the gap up is the open of this bar being greater than the high of the previous day.

Thanks again for the help.

CanOz

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Another Coding Question

Postby TJ » 16 Apr 2012

Thanks TJ.

QUESTION...what is the proper way to code a daily gap up if the daily chart is data2? I can code it when the daily chart is data1, but for my study and strat I need data1 to be a 1 minute chart of the index for the entry and the daily chart to be the first condition, the gap up. In this case the gap up is the open of this bar being greater than the high of the previous day.

Thanks again for the help.

CanOz
First step would be to read my post again...

...The best way to start coding:

1. write out your thoughts one line at a time
2. write out the analysis one line at a time

ie. do not write a paragraph;
write your thoughts in sentences,
one sentence at a time,
and one line per sentence...

ps. see first post format as example


Return to “MultiCharts”