Experimental version 1b is in post one, with an enhancement inspired by Heraclees.
Taking a buy signal, the ea will only add pending buys if the market falls, when none of the originals have filled.
Copy this over the top of void CanWeAddAnotherPendingTrade() to make the changes yourself.
Code: Select all
void CanWeAddAnotherPendingTrade()
{
//This function adds more pending trades if the market initially moves in the opposite direction
//of the signal.
double price = 0;
bool result = false;
double stop = 0, take = 0;
//Another buy stop?
if (!BuyOpen)//Only if the trading sequence has not already started
if (BuyStopOpen)
{
price = NormalizeDouble(LowestBuyStopPrice - ((DistanceBetweenTrades * 2) / factor), Digits);
if (Bid <= price)
if (!DoesTradeExist(OP_BUYSTOP, price))
{
take = CalculateTakeProfit(OP_BUY, price);
stop = CalculateStopLoss(OP_BUY, price);
result = SendSingleTrade(Symbol(), OP_BUYSTOP, TradeCommentCOT, Lot, price, stop, take);
}//if (!DoesTradeExist(OP_BUYSTOP, price))
}//if (BuyStopOpen)
//Another sell stop?
if (!SellOpen)
if (SellStopOpen)
{
price = NormalizeDouble(HighestSellStopPrice + ((DistanceBetweenTrades * 2) / factor), Digits);
if (Bid >= price)
if (!DoesTradeExist(OP_SELLSTOP, price))
{
take = CalculateTakeProfit(OP_SELL, price);
stop = CalculateStopLoss(OP_SELL, price);
result = SendSingleTrade(Symbol(), OP_SELLSTOP, TradeCommentCOT, Lot, price, stop, take);
}//if (!DoesTradeExist(OP_BUYSTOP, price))
}//if (SellStopOpen)
}//End void CanWeAddAnotherPendingTrade()
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. pianodoodler@hotmail.com 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.