Please find below my EA.
It is not finished, because I only put the Buy_STOP orders in. If this works I put the SELL_STOP orders in.
The EA starts ok.
But when the first Pending order is deleted. At the same time it opens a number of Pending orders.
The principal is:
When Close is above SMA5(HIGH) place a pending order x pips above the HIgh.
Delete the pending order as the close is below SMA5 (LOW).
Thanks for your help.
See attached code
One solution is to use execute once per bar:
int start()
{
if(time != Time[0])
{
time = Time[0];
//your code here
}
return(0);
}
Also, you may need a flag to say that you no longer need to place any more orders once the order has been placed etc.
One solution is to use execute once per bar:
int start()
{
if(time != Time[0])
{
time = Time[0];
//your code here
}
return(0);
}
Also, you may need a flag to say that you no longer need to place any more orders once the order has been placed etc.
https://sites.google.com/site/dmweadev/pending-follower
Pending follower will place pending orders above and below the ask/bid price according to the setting that have been entered. When a pending orders value (price) gets too far away from the current pricing it will be deleted and a new pending order will be placed as close to the current pricing as per the setting in the EA.
Here e is a explanation of the settings on the EA
if you are using a 5 digit broker, like alpari, then whenever you enter number of pips you add a zero, ie: 1 pip = 10, 10 pips=100
D5=for 5 dig broker add 0 to values add extra 0 for 5 digit broker IE: for 8 pips use a value of 80
Buy_order=no. of buy orders
buy_orders=x number of pending buy orders to maintain at all times
Sell_order=no. of sell orders
sell_orders=x number of pending sell orders to maintain at all times
step=no. pips above/below current price
Step_in=x initial number of pips above / below current price *-see below for full explanation
step_incr=incremet pips of each pending order
Step_increment=x number of pips to add to above (only used when EA starts up,after that this field is ignored)
s=************************
tp=no of pips from current price order to be closed
trailing_pips=x no. of pips away from current price that pending order will be deleted *-see below for full explanation
Lots=x no. of lots to be traded
slippage=x number of pips that order can deviate from when placing order, if deviation is greater error message will be generated.
SL=x stop loss
TP=x tape profit
comment=testing xx your comment
full explanation
there are 2 prices to take note of:
Ask price and Bid price.
Ask price is used for buy orders, Bid price is used for Sell orders, this is known as "spread".
BuyStop is a pending order to buy assets for a security at a price higher than the current one.
The order will be executed (modified into market order Buy) if the Ask price reaches or rises above the price set in the pending order.
SellStop is a pending order to sell assets for a security at a price lower than the current one.
The order will be executed (modified into market order Sell) if the Bid price reaches or falls below the price set in the pending order.
in the EA "trailing_pips" is the amount of pips that that the pending order's "activation price" is away from the current price.
If the pending order's "activation price" gets bigger (further) than the "trailing_pips" input it will cancel that order and put in a new order closer to the current price
as close as the input "Step_in".
quick instructions:
after downloading the file, place the file into the "experts" folder under " "C:Program Files ' your_broker 'experts".
restart mt4 and the file will be in the experts tab.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Please find below my EA.
It is not finished, because I only put the Buy_STOP orders in. If this works I put the SELL_STOP orders in.
The EA starts ok.
But when the first Pending order is deleted. At the same time it opens a number of Pending orders.
The principal is:
When Close is above SMA5(HIGH) place a pending order x pips above the HIgh.
Delete the pending order as the close is below SMA5 (LOW).
Thanks for your help.
See attached code