Forex Factory (https://www.forexfactory.com/forum.php)
-   Platform Tech (https://www.forexfactory.com/forumdisplay.php?f=69)
-   -   Buy/Sell Script (https://www.forexfactory.com/showthread.php?t=219426)

usdivers Feb 5, 2010 8:02am | Post# 1

Buy/Sell Script
 
Does anyone have a script for metatrader that when you are buying or selling, you can automatically put your profit target in.

IE...what I am looking for is that when I go long or short, the profit target of 5 pips (or whatever I put in) is automatically set.

Anyone ever hear of such a thing?

Pipo Feb 5, 2010 8:12am | Post# 2

2 Attachment(s)
here you go
it's hard coded to 1 lot at 5 pips profit and 20 stoploss. Just open it up with the editor and make the changes to suit you. If you use 5 digit broker 5 pips is then 50 and 20 is 200.
Just another tip as speed is of essence make yourself a hotkey for buy and one for sell you will be lot quicker to collect those pips
Buy.mq4
Sell.mq4

usdivers Feb 5, 2010 8:16am | Post# 3

here you go
it's hard coded to 1 lot at 5 pips profit and 20 stoploss. Just open it up with the editor and make the changes to suit you. If you use 5 digit broker 5 pips is then 50 and 20 is 200.
Thanks...I will try em

forexsaint Feb 5, 2010 12:17pm | Post# 4

Hope this helps.
 
A wide variety of related scripts have been posted --> HERE <--
Esp. Script No.1 , 2 & 3
Hope this helps.

rapidfx Feb 25, 2010 10:58am | Post# 5

here you go
it's hard coded to 1 lot at 5 pips profit and 20 stoploss. Just open it up with the editor and make the changes to suit you. If you use 5 digit broker 5 pips is then 50 and 20 is 200.
Just another tip as speed is of essence make yourself a hotkey for buy and one for sell you will be lot quicker to collect those pips
could we add how many position we want to open..like 50 post..so..when enter this script we can input how many post we want to open at one time..instead of drag 50 times to chart..

Pipo Mar 1, 2010 4:40am | Post# 6

rapidFx, open script with editor and change

double lots = 1.00;
to
#property show_inputs
extern double lots;

compile and you are done.

if you wonna input stoploss and takeprofit then make changes from

double stopsize = 50;
double profsize = 20;
to
extern double stopsize;
extern double profsize;

Anyway for scalping you have the input numbers already in the script you'll be alot quicker

rapidfx Mar 1, 2010 9:31pm | Post# 7

rapidFx, open script with editor and change

double lots = 1.00;
to
#property show_inputs
extern double lots;

compile and you are done.

if you wonna input stoploss and takeprofit then make changes from

double stopsize = 50;
double profsize = 20;
to
extern double stopsize;
extern double profsize;

Anyway for scalping you have the input numbers already in the script you'll be alot quicker
pipo,
what i means is post trade..not lot..let say i want to buy 1 lot gu with tp & sl and i want to open 10 post..so when i drag the script i will open 10 open order with every post 1 lot..hope you could help...thank you.

profi4554 Mar 1, 2010 11:35pm | Post# 8

2 Attachment(s)
pipo,
what i means is post trade..not lot..let say i want to buy 1 lot gu with tp & sl and i want to open 10 post..so when i drag the script i will open 10 open order with every post 1 lot..hope you could help...thank you.
Hi rapidfx,

I wish the script attached could help you achieve what you have been looking for.

Simply adjust the parameter inside the script to your likings.
The defaults are as below;

double Lots = 0.1;
int NumOfOrders = 5; // number of orders to open. Make sure it is not more than the arrays for take profit and stop loss
int OrdersTP[5] = {10, 10, 15, 20, 30}; // take profit values for the orders
int OrdersSL[5] = {50, 50, 50, 50, 50}; // stop loss per order
int NumOfAttemptsPerOrder = 2;



Cheers,
~profi~
Multiorder_Buy.mq4
Multiorder_Sell.mq4

rapidfx Mar 7, 2010 12:14am | Post# 9

Hi rapidfx,

I wish the script attached could help you achieve what you have been looking for.

Simply adjust the parameter inside the script to your likings.
The defaults are as below;

double Lots = 0.1;
int NumOfOrders = 5; // number of orders to open. Make sure it is not more than the arrays for take profit and stop loss
int OrdersTP[5] = {10, 10, 15, 20, 30}; // take profit values for the orders
int OrdersSL[5] = {50, 50, 50, 50, 50}; // stop loss per order
int NumOfAttemptsPerOrder = 2;



Cheers,
~profi~
Hi profi,
I just tried to attached on the chart but not function...even window box does not appear. Could u check again..

profi4554 Mar 7, 2010 4:59am | Post# 10

Hi profi,
I just tried to attached on the chart but not function...even window box does not appear. Could u check again..
Hi rapidfx,

You have to edit the script parameter to suits your requirement from Metaeditor.

Window box will not appear as the parameter are not set as "extern". This is a script and we would like it to execute immediately once being called (using HotKey) or drag&drop on a chart.

Here an example how to edit the script based on your earlier requirement ;

double Lots = 1.0;
int NumOfOrders = 10; // number of orders to open. Make sure it is not more than the arrays for take profit and stop loss
int OrdersTP[10] = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10}; // take profit values for the orders
int OrdersSL[10] = {20, 20, 20, 20, 20, 20, 20, 20, 20, 20}; // stop loss per order
int NumOfAttemptsPerOrder = 2;


Please make sure you already tick (Allow Live Trading) box from Expert Adivsors Tab under Tools --> Options.

Hope this will help you

Cheers,
~profi~

zabidin2 Apr 22, 2012 12:09am | Post# 11

Is this script or EA?

CandleForex Apr 22, 2012 1:20am | Post# 12

Buy / Sell Script
 
It is a script.

An EA generally trades automatically, a script just does a function based on user input.

There are exceptions though.


Is this script or EA?

zabidin2 Apr 24, 2012 5:27am | Post# 13

Have you try this script?? Is it working??

sherifmao May 9, 2012 12:41am | Post# 14

i need script with manager risk .... please if you can help i will be thank you

Mummyz Apr 3, 2013 12:50pm | Post# 15

Hii profi4554,

Can you help me if I want a script with below conditions..

------------------------------------------------------------------------------------
Multiple Pending Buy Script
------------------------------------------------------------------------------------
- Parameter : Open Buy Stop with Hard Coded Price (Ex. 1.2840)
- Parameter : Level (Ex. 10)
- Parameter : Increment (Ex. 20)
------------------------------------------------------------------------------------

------------------------------------------------------------------------------------
Multiple Pending Sell Script
------------------------------------------------------------------------------------
- Parameter : Open Sell Stop with Hard Coded Price (Ex. 1.2820)
- Parameter : Level (Ex. 10)
- Parameter : Increment (Ex. 20)
------------------------------------------------------------------------------------

So the Script will automatically Open Next Buy Stop and Sell Stop for every 20 pips until 10 Levels..
Many Thanks Before..

Zfs Jul 29, 2017 1:11am | Post# 16

is there any who have the script for Buy/Sell only. without other thing. for example, when I press control b for buy and control s for sell. That's all I need. Thanks

gmutota Oct 31, 2019 2:26pm | Post# 17

Anyone that know of a script that opn buy and stop orders at specified time. For example if I want to open a buy stop at 14:30 it will automatically open at that specific time.


© Forex Factory