• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 8:53am
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 8:53am
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

Buy Stop Limit and Sell Stop Limit Orders on MT4 3 replies

Auto SL/TP & buy limit, sell limit/buy stop, sell stop EA/indi 2 replies

Difference between buy limit, sell limit, buy stop, & sell stop? 4 replies

Drag&Drop buy limit and sell limit scripts 1 reply

Help with pending buy stop and sell stop scripts 5 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
  • 6
Attachments: Scripts for Limit entry, Stop entry, Market entry
Exit Attachments

Scripts for Limit entry, Stop entry, Market entry

  • Last Post
  •  
  • Page 1 2 3
  • Page 1 2 3
  •  
  • Post #1
  • Quote
  • First Post: Mar 29, 2008 7:29pm Mar 29, 2008 7:29pm
  •  smjones
  • Joined Mar 2006 | Status: THANK YOU MERLIN,TWEE and FF Team | 4,603 Posts
Here are a couple of scripts I wrote.

Buy With SL and TP. You can just enter the price and the script will figure out if it is a stop or a limit order for you. If you leave the entry field at 0.000 as is default, it will be a market order. You can also enter your StopLoss and Take profit in pips rather than figuring out the price. You can also select true for Auto money management and the percent to risk and the script will figure out your lot size accurately based on account balance and pipvalue for the pair.

The Sell script works the same way as the buy script only for a short.
Attached Files
File Type: mq4 Buy with SL and TP.mq4   2 KB | 7,148 downloads
File Type: mq4 Sell with SL and TP.mq4   2 KB | 5,896 downloads
  • Post #2
  • Quote
  • Mar 29, 2008 9:32pm Mar 29, 2008 9:32pm
  •  trendchaser
  • | Membership Revoked | Joined Oct 2007 | 2,124 Posts
wow cool scripts
 
 
  • Post #3
  • Quote
  • Mar 29, 2008 11:06pm Mar 29, 2008 11:06pm
  •  smjones
  • Joined Mar 2006 | Status: THANK YOU MERLIN,TWEE and FF Team | 4,603 Posts
thanks. I hope they will be of help.
 
 
  • Post #4
  • Quote
  • Apr 3, 2008 9:04am Apr 3, 2008 9:04am
  •  justinwol
  • | Joined Mar 2008 | Status: Member | 8 Posts
Thank you! Just what I was looking for.
 
 
  • Post #5
  • Quote
  • Apr 3, 2008 10:16pm Apr 3, 2008 10:16pm
  •  fyfy
  • | Joined Dec 2006 | Status: Member | 5 Posts
How to open a mq4 file? Please help.
 
 
  • Post #6
  • Quote
  • Edited Apr 4, 2008 12:00pm Apr 3, 2008 10:29pm | Edited Apr 4, 2008 12:00pm
  •  smjones
  • Joined Mar 2006 | Status: THANK YOU MERLIN,TWEE and FF Team | 4,603 Posts
This version allows you to choose how many orders you want opened and also it allows you to either, if UseActualSlTp = false, enter the SL and TP as pips OR if UseActualSlTp = true, just enter the SL price and the TP price. It will still figure out the lot size for you automatically based on AutoMoneyManagement = true.

The RiskPercent is per order. So if you have a RiskPercent of 1 that means 1% of your balance based on this formula per order you select. So if you select say 4 orders, that would be a total risk of 4% of your balance as the maximum you could lose.
Lot (Order) = AccountBalance *risk%/StopLoss/Pipvalue.
Attached Files
File Type: mq4 Buy w SL TP PrSL PrTP MultiLots.mq4   2 KB | 6,616 downloads
File Type: mq4 Sell w SL TP PrSL PrTP MultiLots.mq4   2 KB | 5,666 downloads
 
 
  • Post #7
  • Quote
  • Apr 3, 2008 11:20pm Apr 3, 2008 11:20pm
  •  TradeStar
  • | Joined Feb 2007 | Status: Member | 476 Posts
Quoting smjones
Disliked
This version allows you to choose how many orders you want opened and also it allows you to either, if UseActualSlTp = false, enter the SL and TP as pips OR if UseActualSlTp = true, just enter the SL price and the TP price. It will still figure out the lot size for you automatically based on AutoMoneyManagement = true.

The RiskPercent is per order. So if you have a RiskPercent of 1 that means 1% of your balance based on this formula per order you select. So if you select say 4 orders, that would be a total risk of 4% of your balance as the maximum you could lose.
Lot (Order) = AccountBalance *risk%/StopLoss/Pipvalue.
Ignored
Thanks much.

I launch the script enter the SL and TP pip value and 0 in entry for market order. (UseActualSLTp is also set to False) Hit OK.

I was expecting a sell order to be executed at the market price but nothing happened.

Could you please tell me what am I doing incorrectly? Thanks.

TradeStar
Haste not to Enter AND Haste not to Exit !-TradeStar
 
 
  • Post #8
  • Quote
  • Edited at 8:07am Apr 4, 2008 7:04am | Edited at 8:07am
  •  smjones
  • Joined Mar 2006 | Status: THANK YOU MERLIN,TWEE and FF Team | 4,603 Posts
Quoting TradeStar
Disliked
Thanks much.

I launch the script enter the SL and TP pip value and 0 in entry for market order. (UseActualSLTp is also set to False) Hit OK.

I was expecting a sell order to be executed at the market price but nothing happened.

Could you please tell me what am I doing incorrectly? Thanks.

TradeStar
Ignored
Check the exact stop, takeprofit and balance of your account and risk% and then see if it is bounds for your broker.

If your broker does not allow maximum granularity, ie Lots = .12 it will not enter ther trade. I will add a input for if you are only allowed a mini ie .1 instead.

EDIT: I have changed the two scripts in the post above to include if you are allowed micro and mini order from your broker.

Also, If you set your risk so high or so small as to cause a lots size that is so small based on the stoploss and account balance, or so high for margin, that the order is less or more than your broker will accept, it will not enter a trade.
 
 
  • Post #9
  • Quote
  • Apr 6, 2008 6:17pm Apr 6, 2008 6:17pm
  •  justinwol
  • | Joined Mar 2008 | Status: Member | 8 Posts
I'm working on a 5 min scalping system and these scripts make my system far more user friendly. Thank you very much.

I am wondering, (I'm learning to program, but still a long way to go) if it is possible to add to these scripts a one time moving stop.

For example, I set the original script to 10 s/l and 15 t/p. Now what I do manually is when I reach 10 pip profit I move my s/l to breakeven. Is this something that is possible to program the script to do as well?

You can see how useful that would be for my system. I would essentially be able to see my entry point, activate my script and let it run its course without having to monitor or interfere.

I am assuming it would be similar if not identical to a trailing stop of 10 pips. (Again, as of this time, something I still cannot program myself)
 
 
  • Post #10
  • Quote
  • Apr 6, 2008 6:53pm Apr 6, 2008 6:53pm
  •  smjones
  • Joined Mar 2006 | Status: THANK YOU MERLIN,TWEE and FF Team | 4,603 Posts
Quoting justinwol
Disliked
I'm working on a 5 min scalping system and these scripts make my system far more user friendly. Thank you very much.

I am wondering, (I'm learning to program, but still a long way to go) if it is possible to add to these scripts a one time moving stop.

For example, I set the original script to 10 s/l and 15 t/p. Now what I do manually is when I reach 10 pip profit I move my s/l to breakeven. Is this something that is possible to program the script to do as well?

You can see how useful that would be for my system. I would essentially be able to see my entry point, activate my script and let it run its course without having to monitor or interfere.

I am assuming it would be similar if not identical to a trailing stop of 10 pips. (Again, as of this time, something I still cannot program myself)
Ignored
Hi a trailing stop to BE or anything else, would have to be a EA, because by definition a script can only execute once. A Ea executes each time there is a new tick. The good news is that this script could be converted into a EA with trailing stops and BE stop at a certian price or TP, but I do not have time to do it right now. I posted the code and it is really well laid out and easy to follow if someone else wants to try. Or when I get time I will do it.
 
 
  • Post #11
  • Quote
  • Apr 7, 2008 2:10am Apr 7, 2008 2:10am
  •  extremfx
  • | Joined Mar 2007 | Status: Member | 39 Posts
smjones, a great thanks for your scripts !
 
 
  • Post #12
  • Quote
  • Apr 7, 2008 5:58pm Apr 7, 2008 5:58pm
  •  WNW
  • | Joined Mar 2006 | Status: Member | 24 Posts
Perfect!
Exactly what I need and more.
Thanks very much.
 
 
  • Post #13
  • Quote
  • Apr 8, 2008 10:34am Apr 8, 2008 10:34am
  •  hanover
  • Joined Sep 2006 | Status: ... | 8,090 Posts
Quoting smjones
Disliked
This version allows you to choose how many orders you want opened and also it allows you to either, if UseActualSlTp = false, enter the SL and TP as pips OR if UseActualSlTp = true, just enter the SL price and the TP price. It will still figure out the lot size for you automatically based on AutoMoneyManagement = true.

The RiskPercent is per order. So if you have a RiskPercent of 1 that means 1% of your balance based on this formula per order you select. So if you select say 4 orders, that would be a total risk of 4% of your balance as the maximum you could lose.
Lot (Order) = AccountBalance *risk%/StopLoss/Pipvalue.
Ignored
Hi Scott,



Just a minor point, but I think your lline of code that reads:

if ((Lots < 0.01&&MicroOrdersAllowed) || (Lots < 0.1&&MiniOrdersAllowed&&MicroOrdersAllowed==false))


would be better as:

if ((Lots < 0.01) || (Lots < 0.1 && MicroOrdersAllowed==false) || (Lots < 1 && MiniOrdersAllowed==false))

What do you think?

Sorry if I've misunderstood.

David
 
 
  • Post #14
  • Quote
  • Edited at 4:22pm Apr 8, 2008 11:27am | Edited at 4:22pm
  •  smjones
  • Joined Mar 2006 | Status: THANK YOU MERLIN,TWEE and FF Team | 4,603 Posts
Quoting hanover
Disliked
Hi Scott,





Just a minor point, but I think your lline of code that reads:

if ((Lots < 0.01&&MicroOrdersAllowed) || (Lots < 0.1&&MiniOrdersAllowed&&MicroOrdersAllowed==false))


would be better as:

if ((Lots < 0.01) || (Lots < 0.1 && MicroOrdersAllowed==false) || (Lots < 1 && MiniOrdersAllowed==false))

What do you think?

Sorry if I've misunderstood.

David
Ignored
Yes my code works fine, but yours is more compact and elegant. Feel free to change the code if you wish.
 
 
  • Post #15
  • Quote
  • Apr 9, 2008 4:08am Apr 9, 2008 4:08am
  •  kins
  • | Membership Revoked | Joined Apr 2008 | 12 Posts
smjones can you help me to wirte a scripts for MT4 such that when open price comes out it will buy hwne the price moves up to 30pips and sell when it move down to 40pips. pls let me be changing the lotsize and take profit. pls i beg you i need it urgently to try something.
 
 
  • Post #16
  • Quote
  • Apr 24, 2008 3:28pm Apr 24, 2008 3:28pm
  •  El Salon
  • | Joined Sep 2007 | Status: Member | 81 Posts
Hi there smjones

I like the looks of this.

I'm wondering if it is at all possible for this to be tweeked or added to so that the buy stop or sell stop is placed X number of pips above the high (for buy) or below (for sell) of the preceeding time frame once a go signal has been given by an indicator.


Thanks

James
 
 
  • Post #17
  • Quote
  • Apr 27, 2008 7:48pm Apr 27, 2008 7:48pm
  •  pranxtrr
  • | Joined Nov 2005 | Status: Member | 6 Posts
Is it possible to write a script that is a trailing buy/stop or sell/stop market entry with a programmable amount of pips?
Example: if you are trying to predict the bottom of the move and you want to enter the market with a buy and you wanted to protect your position from going against you and was willing to enter (lets say 4 pips plus the spread above the bottom). the script would trail the move down with a buy/stop and execute a buy market order 4 pips from the bottom or turn around.
thanks for your help
 
 
  • Post #18
  • Quote
  • Apr 27, 2008 9:10pm Apr 27, 2008 9:10pm
  •  magnumfreak
  • Joined Nov 2007 | Status: Trying manual mode again | 2,210 Posts
Quoting pranxtrr
Disliked
Is it possible to write a script that is a trailing buy/stop or sell/stop market entry with a programmable amount of pips?
Example: if you are trying to predict the bottom of the move and you want to enter the market with a buy and you wanted to protect your position from going against you and was willing to enter (lets say 4 pips plus the spread above the bottom). the script would trail the move down with a buy/stop and execute a buy market order 4 pips from the bottom or turn around.
thanks for your help
Ignored
To answer your question..... Yes, it is possible.
 
 
  • Post #19
  • Quote
  • Apr 27, 2008 11:47pm Apr 27, 2008 11:47pm
  •  pranxtrr
  • | Joined Nov 2005 | Status: Member | 6 Posts
has anyone created this script or know where or how can create it???
 
 
  • Post #20
  • Quote
  • Jun 3, 2008 12:04pm Jun 3, 2008 12:04pm
  •  brucech
  • | Joined Sep 2006 | Status: Member | 594 Posts
Quoting pranxtrr
Disliked
Is it possible to write a script that is a trailing buy/stop or sell/stop market entry with a programmable amount of pips?
Example: if you are trying to predict the bottom of the move and you want to enter the market with a buy and you wanted to protect your position from going against you and was willing to enter (lets say 4 pips plus the spread above the bottom). the script would trail the move down with a buy/stop and execute a buy market order 4 pips from the bottom or turn around.
thanks for your help
Ignored
Has anyone made this EA yet?
If so would you please share it?

Thanks.

Bruce
 
 
  • Platform Tech
  • /
  • Scripts for Limit entry, Stop entry, Market entry
  • Reply to Thread
    • Page 1 2 3
    • Page 1 2 3
1 trader viewing now
  • More
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2022