| New signals service! | |
|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
A Simple Buy/Sell Script
Does anyone have a simple script (not an EA) that will buy/sell orders
with a stop and a target profit input? OR The attached buy/sell scripts don't have a target profit parameter. If someone could please add target profits to the attached scripts that would also work. Either scenario would be appreciated. Thanks. |
|
|||
|
Suppose you want to set the profit target to 30 pips, then do the following:
Look up this line in the buy routine, ticket=OrderSend(Symbol(),OP_BUY,1.0,Ask,3,Ask-20*Point,0,"expert comment",255,0,CLR_NONE); and make it look like this: ticket=OrderSend(Symbol(),OP_BUY,1.0,Ask,3,Ask-20*Point,Bid+30*Point,"expert comment",255,0,CLR_NONE); |
|
|||
|
I think you owe it to yourself to study MQL if you are going to to use it. Otherwise depending on others is too dangerous.
Study the code I gave you and see WHAT changes and WHERE the changes I made. That should give you clues on what to change in the sell routine. Good luck. |
|
|||
|
Okay, you should try to understand the code better. I think if you had spent some time, your definitely would have understood how the buy/sell ordersend functions work.
For the sell, assuming you want 30 pips of stop loss, change ticket=OrderSend(Symbol(),OP_SELL,1.0,Bid,3,Bid+20 *Point,0,"expert comment",255,0,CLR_NONE); to ticket=OrderSend(Symbol(),OP_SELL,1.0,Bid,3,Bid+20 *Point,Ask - 30*Point,"expert comment",255,0,CLR_NONE); Edit:- I had an error that I corrected. Thanks for pointing it out. Last edited by Maji; 07-17-2006 at 06:58 PM. |
|
|||
|
I actually took a look at again before your last post and figured it out. But my changes look a bit different but it seems to work okay.
I had: ticket=OrderSend(Symbol(),OP_SELL,10.0,Bid,3,Bid+2 0*Point,Bid-30*Point,"expert comment",255,0,CLR_NONE); Thanks again. |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help: How to write simple EA to buy and sell at a specific time? | jack2 | Expert Advisors - Metatrader 4 | 59 | 09-22-2008 03:17 AM |
| Simple script to plot Horizontal lines | SaxMan | Indicators - Metatrader 4 | 2 | 10-15-2007 03:10 AM |
| EAs that sell the ask and buy the bid... | forextrades | Expert Advisors - Metatrader 4 | 2 | 08-23-2006 01:58 AM |
| Script for buy/sell | sadaloma | Metatrader 4 | 2 | 01-15-2006 11:54 PM |