Trendline Break Executor
  #1 (permalink)  
Old 01-09-2006, 04:51 PM
Freshman
 
Join Date: Jul 2005
Posts: 17
Thanks: 0
Thanked 2 Times in 1 Post
freshfx is on a distinguished road
Default Trendline Break Executor

Friends, I would like a script that executes a buy or sell order with stop loss and take profit when price crosses a trendline that is drawn on the chart. Also, it would be nice if the script had the ability to disable the buy/sell function and only generate an alert when the trendline is crossed by the price. It would be a script, not an EA, in that it would execute only once after it was applied to the chart which could be any timeframe. Any suggestions how to do this. I wish you all the best in 2006!
Reply With Quote
The Following 2 Users Say Thank You to freshfx For This Useful Post:
  #2 (permalink)  
Old 01-09-2006, 06:02 PM
gazuz's Avatar
Senior Trader and Moderat
 
Join Date: Aug 2004
Posts: 768
Thanks: 1
Thanked 8 Times in 5 Posts
gazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to all
Default

is the trend line drawn manually or from an indicator?
__________________
____________________________\¦/
___________________________(ò ó)
______________________o0o___(_)___o0o__
___¦_____¦_____¦_____¦_____¦_____¦_____¦
¦_____¦_____¦_____¦_____¦_____¦_____¦__
___¦_____¦_____¦_____¦_____¦_____¦_____¦
¦_____¦_____¦_____¦_____¦_____¦_____¦__
Reply With Quote
  #3 (permalink)  
Old 01-10-2006, 09:40 AM
Freshman
 
Join Date: Jul 2005
Posts: 17
Thanks: 0
Thanked 2 Times in 1 Post
freshfx is on a distinguished road
Default

The trendline is drawn manually using the trendline drawing function provided with the MT4 platform. There are three line drawing functions provides with the platform: Vertical Line, Horizontal Line, and Trendline. These are represent by three buttons on the upper left toolbar with the appropriate symbols. The trendline function is represented by a diagonal line "/ " foward slash symbol. When the trendline is drawn it is registered in the program by a number in the Object List, for example, Trendline 45321. The Object List can be accessed by right clicking on the chart and selecting Object List. The Script could reference the trendline by its reference number.
Reply With Quote
  #4 (permalink)  
Old 01-10-2006, 03:05 PM
scorpion's Avatar
Administrator
 
Join Date: Aug 2004
Posts: 1,923
Thanks: 97
Thanked 361 Times in 147 Posts
scorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to behold
Send a message via MSN to scorpion Send a message via Yahoo to scorpion
Default

It's possible, but why do you need it if you need to execute the script by hand anyway? You said you need script not EA. Script is executed manually, but EA is executed automatically when new tick arrives. You can disable auto trade execution of EA if you want to, cos it's configuratable. Maybe you are confused?
__________________
Make easy pips with the Advanced Economic Calendar for Forex Trading.
Reply With Quote
  #5 (permalink)  
Old 01-11-2006, 07:11 AM
Freshman
 
Join Date: Jul 2005
Posts: 17
Thanks: 0
Thanked 2 Times in 1 Post
freshfx is on a distinguished road
Default

Friends, the Expert Advisor Wizard in the MetaEditor of the MQL4 language allows for the creation of three distinct types of user defined programs: the Expert Advisor program, the Custom Indicator program, and the Script program. While the expert advisor contains a loop function that allows it to be executed repeatedly, the script program is designed for single use only. You do not need to execute the script by hand, you only need place it on the chart once similar to the expert advisor. The difference is that it only executes one time, not repeatedly. The script I have in mind is similar to a buy stop or a sell stop, but the difference is that whereas a buy or sell stop is fixed to a single price (a horizontal line), a diagonal line would trigger at a changing price depending on where price crossed the line. My idea is to trigger a trade on a breakout without having to constantly monitor the charts.
Reply With Quote
  #6 (permalink)  
Old 01-11-2006, 09:27 AM
scorpion's Avatar
Administrator
 
Join Date: Aug 2004
Posts: 1,923
Thanks: 97
Thanked 361 Times in 147 Posts
scorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to behold
Send a message via MSN to scorpion Send a message via Yahoo to scorpion
Default

Because if trendline is diagonal, the order price must be constantly modified to go along with the line. So if order price is needed to be constantly modified, it's the job of Expert Advisor not script, because script, like you said, run only one-time when you double click on it.

By the time I described to you, I've coded the expert advisor for you already, so check it out in Forward Testing not Backtesting. You must draw a trendline and name it tx (case sensitive). Attach the expert to the same chart that trendline is drawn. Then you can choose to open only Long, Short, Both, or none in the settings window. When bid price crosses up the trendline, buy at market price. When bid price crosses down the trendline, sell at market price.

Enjoys!
Attached Files
File Type: mq4 TrendlineOrder.mq4 (10.0 KB, 935 views)
Best Forex Systems
Proven forex trading systems for auto trading.
See the real trading records yourself.
__________________
Make easy pips with the Advanced Economic Calendar for Forex Trading.
Reply With Quote
The Following 10 Users Say Thank You to scorpion For This Useful Post:
  #7 (permalink)  
Old 01-13-2006, 04:46 AM
Freshman
 
Join Date: Jul 2005
Posts: 17
Thanks: 0
Thanked 2 Times in 1 Post
freshfx is on a distinguished road
Default

Thank you scorpion, works great! I just put it on a 15 min chart to test and it has given an alert and I made a trade. In fact, I had the alert set and it must have crossed the tx trendline a couple of times because I got two alerts. This is just what I wanted, thank you.
Reply With Quote
  #8 (permalink)  
Old 01-13-2006, 06:46 AM
scorpion's Avatar
Administrator
 
Join Date: Aug 2004
Posts: 1,923
Thanks: 97
Thanked 361 Times in 147 Posts
scorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to behold
Send a message via MSN to scorpion Send a message via Yahoo to scorpion
Default

You're welcome mate.

Forgot to mention that the expert supports multiple pairs as well. You can trade eurusd, gbpusd, etc at the same time.
__________________
Make easy pips with the Advanced Economic Calendar for Forex Trading.
Reply With Quote
  #9 (permalink)  
Old 10-16-2006, 08:09 AM
Freshman
 
Join Date: Sep 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
coin.inv is on a distinguished road
Default

could you explain the 4 TS settings, are these trailing stop features and if so is there a trailingstop feature that will begin to trail immediately.

also could you script this?
/*
NEED A ONE TIME EXECUTEALBLE SCRIPT
*/

extern double TradeType=1 // 1=buy 2=sell // could also make a buy script and a sell script
extern double StopLoss=30;
extern double TakeProfit=500;
extern double TrailingStop=15;
extern bool TrailImmediately=true;
extern double Slippage=1;
extern double Lots=0.1;
extern int OrderTries=5;
// Build unique magic number for multiple positions/pairs/monitor trailing/adjusttrailing stops
// IS THIS EVEN POSSIBLE???


THANKS!
Reply With Quote
  #10 (permalink)  
Old 10-18-2006, 02:39 AM
Sophomore
 
Join Date: Oct 2006
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
forodo is on a distinguished road
Default

bro scorpio...can u give screenshoot for trendlineonline ?...and step by step to use that thing..so sorry, im newbie in this forex....
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
What's wrong with this moving average alert? forextrend Indicators 3 03-28-2006 03:53 AM


All times are GMT. The time now is 08:23 PM.
Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0

Registered members have access to special online forex currency trading tools, software, mt4 expert advisors and indicators. Register now