Hi,
does anyone of you have or know of a script that does the following:
For Buy pending:
When i drag it onto the chart, it will place a pending order X pips + Spread above LAST candles high?
For Sell panding:
The opposite...
Cheers
Philipp
Script for placing pending orders
- Sgt.Forex
- Trader
- Posts: 55
- Joined: Wed Nov 16, 2011 11:03 am
- Location: Germany
Script for placing pending orders
Money makes the world go round!
- SteveHopwood
- Owner
- Posts: 9754
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Re: Script for placing pending orders
Here you are Philipp.
CandleShift allows you to use the hi/lo of any candle you choose - defaults to the previous candle.
I knocked these together this morning, so sing out if anything is not quite right.
CandleShift allows you to use the hi/lo of any candle you choose - defaults to the previous candle.
I knocked these together this morning, so sing out if anything is not quite right.
You do not have the required permissions to view the files attached to this post.
Read the effing manual, ok?
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. [email protected] is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. [email protected] is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
- Sgt.Forex
- Trader
- Posts: 55
- Joined: Wed Nov 16, 2011 11:03 am
- Location: Germany
Re: Script for placing pending orders
Wow, nice one Steve! Thank you very much!SteveHopwood wrote:Here you are Philipp.
CandleShift allows you to use the hi/lo of any candle you choose - defaults to the previous candle.
I knocked these together this morning, so sing out if anything is not quite right.
I will report back.
Cheers
Money makes the world go round!
- Sgt.Forex
- Trader
- Posts: 55
- Joined: Wed Nov 16, 2011 11:03 am
- Location: Germany
Re: Script for placing pending orders
Here is the report
I am getting an error message:
-> Buy pending worked on the same candle.
Cheers
I am getting an error message:
Code: Select all
2012.12.20 15:17:17 Philipp's Pending Sell Script XAUUSD.arm,H1: XAUUSD.arm Philipp's Pending Sell Script OP_SELLSTOP order send failed with error(4107): invalid price parameter for trade function
Cheers
Money makes the world go round!
- SteveHopwood
- Owner
- Posts: 9754
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Re: Script for placing pending orders
Works fine here/ Make sure you are using it when it can work - can't send a sell stop if the market is already lower than the low of the previous candle.Sgt.Forex wrote:Here is the report
I am getting an error message:-> Buy pending worked on the same candle.Code: Select all
2012.12.20 15:17:17 Philipp's Pending Sell Script XAUUSD.arm,H1: XAUUSD.arm Philipp's Pending Sell Script OP_SELLSTOP order send failed with error(4107): invalid price parameter for trade function
Cheers
Read the effing manual, ok?
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. [email protected] is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. [email protected] is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
- Sgt.Forex
- Trader
- Posts: 55
- Joined: Wed Nov 16, 2011 11:03 am
- Location: Germany
Re: Script for placing pending orders
Hmm, ok i will retry. But the Price wasn`t lower, than the low of the previous candle.
Cheers
Cheers
Money makes the world go round!
- Sgt.Forex
- Trader
- Posts: 55
- Joined: Wed Nov 16, 2011 11:03 am
- Location: Germany
Re: Script for placing pending orders
Tried to use it on XAU/USD -> only the buystop worked.Sgt.Forex wrote:Hmm, ok i will retry. But the Price wasn`t lower, than the low of the previous candle.
Cheers
Tried to use it on EUR/CHF -> both worked.
Maybe its a "Gold bug" ?
Cheers
Money makes the world go round!
-
- Trader
- Posts: 1334
- Joined: Sun Dec 04, 2011 4:11 am
Re: Script for placing pending orders
Hi Steve,
I am confused. Why is double spread = Ask - Bid, and not double spread = (Ask - Bid) * factor in your script code ?
This will make the spread calculation in the price equals to (Ask - Bid)/factor instead of (Ask - Bid) which is already in the correct decimal.
Peter
I am confused. Why is double spread = Ask - Bid, and not double spread = (Ask - Bid) * factor in your script code ?
Code: Select all
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
RefreshRates();
price = 0; stop = 0; take = 0;
double spread = Ask - Bid;
//Set up a dummy for functions that might not be called, so they do not disturb the punters.
int x = 0;
if (x > 0)
{
CloseEnough(0, 0);
}//if (x == 0)
price = High[CandleShift] + (AddToHighPips / factor) + (spread / factor);
stop = CalculateStopLoss(OP_BUY);
take = CalculateTakeProfit(OP_BUY);
SendSingleTrade(OP_BUYSTOP, TradeComment, Lot, price, stop, take);
Peter
- SteveHopwood
- Owner
- Posts: 9754
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Re: Script for placing pending orders
Nice spot Peter. Thanks. I have a shell script that doesn't multiply the spread and I am so used to dividing it by factor when I use it, that I forgot.fx8000 wrote:Hi Steve,
I am confused. Why is double spread = Ask - Bid, and not double spread = (Ask - Bid) * factor in your script code ?
This will make the spread calculation in the price equals to (Ask - Bid)/factor instead of (Ask - Bid) which is already in the correct decimal.Code: Select all
//+------------------------------------------------------------------+ //| script program start function | //+------------------------------------------------------------------+ int start() { RefreshRates(); price = 0; stop = 0; take = 0; double spread = Ask - Bid; //Set up a dummy for functions that might not be called, so they do not disturb the punters. int x = 0; if (x > 0) { CloseEnough(0, 0); }//if (x == 0) price = High[CandleShift] + (AddToHighPips / factor) + (spread / factor); stop = CalculateStopLoss(OP_BUY); take = CalculateTakeProfit(OP_BUY); SendSingleTrade(OP_BUYSTOP, TradeComment, Lot, price, stop, take);
Peter
I have updated the scripts in post 2.
Read the effing manual, ok?
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. [email protected] is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. [email protected] is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
-
- Trader
- Posts: 1334
- Joined: Sun Dec 04, 2011 4:11 am
Re: Script for placing pending orders
The sell script is giving rise to error (4107) : invalid price parameter for trade function.
This may be caused by the sell script
price = xxx - SubtractFromLow - xxx, instead of price = xxx - SubtractFromLowPips - xxx,
because the code failed to make a call to extern int SubtractFromLowPips = xxx ?
A typo error ?
The buy script works just fine.
pete
This may be caused by the sell script
price = xxx - SubtractFromLow - xxx, instead of price = xxx - SubtractFromLowPips - xxx,
because the code failed to make a call to extern int SubtractFromLowPips = xxx ?
A typo error ?
The buy script works just fine.
pete