Jump to content

REQ: Trend Line Indicator


Recommended Posts

I am looking for a Trend Line Indicator that can plot the following:

 

1) Upper line connecting the higher high of the last 12 bars of the previous day with the higher high of the last 3 bars of the current day

 

and

 

2) Lower line connecting the lower low of the last 12 bars of the previous day with the lower low of the last 3 bars of the current day

 

Does anyone have such an indicator please?

Link to comment
Share on other sites

This sort of indicator should be simple to code, however which bars are you referring to ?

 

I'm assuming 1H bars though I may be wrong :-/

 

As an added incentive for anyone coding the indicator it would be handy to know how it will help you in selecting high probability trades ;)

Link to comment
Share on other sites

Yeah, I am referring to the 1 H bars. Basically it is yet another trend line breakout stuff. Anything breaking the upper line, buy. Anything the breaking the lower line, sell. Both during the London hours.

 

Visually, it does seem to hold promise. :)

Link to comment
Share on other sites

Hi gctex,

 

I had a bit of spare time so I've attempted to create this indicator. It looks to be working ok, though let me know of any problems.

 

http://www.multiupload.com/Q26QNVJLNI

 

Beautiful !!! that's pretty much I can say about it ... :)

 

Thanks a great lot.

 

If possible, can you please add these:

 

1) Can you also display the buffer values of upper & lower trend lines so that I can call it from an EA?

2) It draws the trend lines for the latest day. Is it possible to draw the trend lines for each previous day? (Would be helpful for easy visual confirmation)

 

Thanks once again

Link to comment
Share on other sites

Hi gctex

 

As you know, different Brokers' MT4 Platforms may have different day-start/ day-end (e.g. GMT midnight, US Eastern midnight). So the resulting trend lines could be different.

 

Could you please tell us, what is the day-start/day-end you consider for this strategy.

Edited by smurf43
Link to comment
Share on other sites

hi gctex,

 

I'm glad to hear that the basic indicator is what you were looking for :)

 

Regarding your point 1) Currently the indicator doesn't use buffers at all, though we should be able to write the High start and end prices and Low start and end prices into 4 "dummy" buffers.

 

Point 2) I'm not so sure that's going to be a good idea as things stand, though I can see it would be handy for manually backtesting. Drawing trendlines for each previous day going back as far as the bars on the chart as currently coded means that you're going to end up with lines everywhere and total confusion lol. Ideally, we'd need the trendlines to stop at the end point for each day rather than have all of them drawing lines into the future.

 

I've not got time to make these changes myself right now, though there are plenty of coders around here who should be able to help.

Link to comment
Share on other sites

Yeah smurf, I am going by 3:00 AM CST. Here are more details about this strategy.

 

http://forex-strategies-revealed.com/advanced/trendlines-breakout

 

I guess someone already wrote an EA about it, if you wish to check it out:

 

http://forums.forex-strategies-revealed.com/advanced-system-trend-lines-breakout-system-t218-130.html

 

SoundFx's indicator works just fine, if only it can be made to draw the trend lines for all previous days plus the buffer values, then I can just plug it into my existing EA and test it fine.

Link to comment
Share on other sites

Well when I tested it during the weekend it looked fine, but now the start points of these trend lines are not restricted to the last 12 bars of the previous day. It tries to to draw the trend lines from a few days before. Not sure why.
Link to comment
Share on other sites

gctex,

 

Try putting the following lines after the line "Yesterday = Today - 1;"

 

if (TimeDayOfWeek(iTime(NULL,0,0)) == 0) Yesterday = Today - 2;

if (TimeDayOfWeek(iTime(NULL,0,0)) == 1) Yesterday = Today - 3;

 

fxeasy5,

 

I'm not an expert coder and didn't even consider that 4 digit brokers would make a difference (in fact I didn't realise they still existed lol). There's still nothing obvious that I can see in the code which should cause a crash.

Link to comment
Share on other sites

Hey soundfx that worked! ... now I know u r busy so I am trying to add the buffers myself. If you can please let me know if this looks ok I'd be grateful.

 

===================

#property indicator_buffers 2

 

--------------

 

double Up[];

double Dn[];

 

-------------

 

SetIndexBuffer(0, Up);

SetIndexBuffer(1, Dn);

--------------

 

string nameh = "HighLine";

string namel = "LowLine";

 

-------------

 

if (iHigh(NULL,0,BarCount) > HighLineEnd) {

HighLineEnd = iHigh(NULL,0,BarCount);

HighLineEndTime = iTime(NULL,0,BarCount);

 

datetime time0L;

if (ObjectFind(nameh) != -1) {

double tlh = ObjectGetValueByShift(nameh, 0);

if (time0L != Time[0]){

Up[0] = tlh;

}

}

}

-------------

 

The above code is (my humble attempt) to print the Upper buffer value. For some reason it doesn't work right. Btw, you mentioned 4 buffers but then you have only two objects "HighLine" & "LowLine". So why you need 4 buffers?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...