Attached is an extract from the updated user guide, describing the functionality I have added.
Desky. TDesk's trading drone.
- SteveHopwood
- Owner
- Posts: 9904
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Desky. TDesk's trading drone.
Version 2p is in post 1, with implementations of simple and complex single-sided offsetting.
Attached is an extract from the updated user guide, describing the functionality I have added.

Attached is an extract from the updated user guide, describing the functionality I have added.
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. 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.
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.
- c1borg
- Trader
- Posts: 456
- Joined: Sun Aug 14, 2016 5:09 pm
Desky. TDesk's trading drone.
I am having issues with version p removing itself when initialising, anyone else had any issues or is it something stupid I may be doing? Version o loads and runs perfectly.
You do not have the required permissions to view the files attached to this post.
-
Alexfirst
- Trader
- Posts: 21
- Joined: Thu Jun 18, 2015 6:10 pm
Desky. TDesk's trading drone.
I have this issue too.
- SteveHopwood
- Owner
- Posts: 9904
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Desky. TDesk's trading drone.
I knew what I had done straight away - fixed in post 1. This problem would arise immediately the bot took a trade or was loaded with open trades.
Easy DIY vix: Do a search for
return(BetterOrderSelect(index,select,pool));
Replace it with:
return(OrderSelect(index,select,pool));
I originally lifted the offsetting code from HGBnD, an EA I wrote before Thomas provided the BetterOrderSelect() function. The bloop causes a stack overflow and causes the bot to resign in protest.
All your unsupervised VPS demos will have this problem.

Easy DIY vix: Do a search for
return(BetterOrderSelect(index,select,pool));
Replace it with:
return(OrderSelect(index,select,pool));
I originally lifted the offsetting code from HGBnD, an EA I wrote before Thomas provided the BetterOrderSelect() function. The bloop causes a stack overflow and causes the bot to resign in protest.
All your unsupervised VPS demos will have this problem.
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.
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.
-
Alexfirst
- Trader
- Posts: 21
- Joined: Thu Jun 18, 2015 6:10 pm
Desky. TDesk's trading drone.
Thanks for a fast fix, Steve. And for offsetting feature!
-
luipogifx
- Trader
- Posts: 17
- Joined: Sat Dec 01, 2018 5:30 am
Desky. TDesk's trading drone.
Hello Steve,
I'm currently testing 2p. It keeps on opening and closing pending trades.
My active settings are:
Grid trading
Useoffsetting simple mode
Hedge on opposite signal
Delete pending trades on opposite signal
The affected currency pair is EURCAD, and it currently has a sell hedge trade.
I'm currently traveling and I only use phone to access my VPS.
Seems like it will keep on opening and closing pending trades when the super signal is in the direction of the hedge trade. It will stop closing and pending trades when the signal is flat.
I will observe more.
I'm currently testing 2p. It keeps on opening and closing pending trades.
My active settings are:
Grid trading
Useoffsetting simple mode
Hedge on opposite signal
Delete pending trades on opposite signal
The affected currency pair is EURCAD, and it currently has a sell hedge trade.
I'm currently traveling and I only use phone to access my VPS.
Seems like it will keep on opening and closing pending trades when the super signal is in the direction of the hedge trade. It will stop closing and pending trades when the signal is flat.
I will observe more.
You do not have the required permissions to view the files attached to this post.
- SteveHopwood
- Owner
- Posts: 9904
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Desky. TDesk's trading drone.
V 2q is in post 1, with the fix for the pending orders stuff that c1borg posted in the 'Confused' thread - http://www.stevehopwoodforex.com/phpBB3 ... 29#p165929
I could not believe the bollocks I had coded when I looked at it in response to c1borg's thread.
I do have an excuse. Any of us who have developed as self-taught coders will find the same thingy here. How to code something does not tend to be difficult - CrapQl4 is a very simple language. It is the what to code that can be a bit of a bugger to work out.
It is quite some time since I last worked out the what to code quite as badly as this little lot.
There was no need to update the user guide. The new inputs should be self-explanatory.
DIYers, do this:
Do a search for: "enum PendingTradeTypes". It is only a few lines down. Copy this over the top of the existing code block:
Then do a search for: "extern PendingTradeTypes TypeOfPendingTrade=". I cannot remember what the original default was, so change it to:
extern PendingTradeTypes TypeOfPendingTrade=Stop_order_only;
Then search for, "void CanWeSendTrades(string symbol, int pairIndex, int signal)" to navigate to the relevant function. Easiest is to simply copy this over the top of the existing function:
Thanks for your persistence c1borg.
I cannot test every permutation available to Desky, or consider every moment of personal lunacy. I rely on the likes of you to point them out.

I could not believe the bollocks I had coded when I looked at it in response to c1borg's thread.
I do have an excuse. Any of us who have developed as self-taught coders will find the same thingy here. How to code something does not tend to be difficult - CrapQl4 is a very simple language. It is the what to code that can be a bit of a bugger to work out.
It is quite some time since I last worked out the what to code quite as badly as this little lot.
There was no need to update the user guide. The new inputs should be self-explanatory.
DIYers, do this:
Do a search for: "enum PendingTradeTypes". It is only a few lines down. Copy this over the top of the existing code block:
Code: Select all
enum PendingTradeTypes
{
Stop_order_only,
Limit_order_only,
Stop_and_Limit_orders,
};extern PendingTradeTypes TypeOfPendingTrade=Stop_order_only;
Then search for, "void CanWeSendTrades(string symbol, int pairIndex, int signal)" to navigate to the relevant function. Easiest is to simply copy this over the top of the existing function:
Code: Select all
void CanWeSendTrades(string symbol, int pairIndex, int signal)
{
bool result = false;
if (!hedged)
if (!StopTrading)
{
if (TimeCurrent() >= TimeToStartTrading[pairIndex])
{
if (OpenTrades < MaxTradesAllowed)
{
if (BuySignal || SellSignal)
{
if (BuySignal)
{
//Immediate market trade
if (SendImmediateMarketTrade)
result = LookForTradingOpportunities(symbol, pairIndex, OP_BUY);
//Pending orders
if (SendPendingTrades)
{
if (TypeOfPendingTrade == Stop_order_only)
result = LookForTradingOpportunities(symbol, pairIndex, OP_BUYSTOP);
if (TypeOfPendingTrade == Limit_order_only)
result = LookForTradingOpportunities(symbol, pairIndex, OP_BUYLIMIT);
if (TypeOfPendingTrade == Stop_and_Limit_orders)
{
result = LookForTradingOpportunities(symbol, pairIndex, OP_BUYSTOP);
Sleep(5000);//Give the platform time to catch up
result = LookForTradingOpportunities(symbol, pairIndex, OP_BUYLIMIT);
}//if (TypeOfPendingTrade == Stop_and_Limit_orders)
}//if (SendPendingTrades)
if (UseGridTrading && (SendImmediateMarketTrade || SendPendingTrades))
if (result)
{
if (TypeOfGrid == Stop || TypeOfGrid == Both)
{
SendBuyGrid(symbol, OP_BUYSTOP, ask, Lot, GridSize );
}//if (TypeOfGrid == OP_BUYSTOP || TypeOfGrid == Both)
if (TypeOfGrid == Limit || TypeOfGrid == Both)
{
SendBuyGrid(symbol, OP_BUYLIMIT, ask, Lot, GridSize );
}//if (TypeOfGrid == OP_BUYSTOP || TypeOfGrid == Both)
}//if (result)
}//if (BuySignal)
if (SellSignal)
{
//Immediate market trade
if (SendImmediateMarketTrade)
result = LookForTradingOpportunities(symbol, pairIndex, OP_SELL);
//Pending orders
if (SendPendingTrades)
{
if (TypeOfPendingTrade == Stop_order_only)
result = LookForTradingOpportunities(symbol, pairIndex, OP_SELLSTOP);
if (TypeOfPendingTrade == Limit_order_only)
result = LookForTradingOpportunities(symbol, pairIndex, OP_SELLLIMIT);
if (TypeOfPendingTrade == Stop_and_Limit_orders)
{
result = LookForTradingOpportunities(symbol, pairIndex, OP_SELLSTOP);
Sleep(5000);//Give the platform time to catch up
result = LookForTradingOpportunities(symbol, pairIndex, OP_SELLLIMIT);
}//if (TypeOfPendingTrade == Stop_and_Limit_orders)
}//if (SendPendingTrades)
if (UseGridTrading && (SendImmediateMarketTrade || SendPendingTrades))
if (result)
{
if (TypeOfGrid == Stop || TypeOfGrid == Both)
{
SendSellGrid(symbol, OP_SELLSTOP, bid, Lot, GridSize );
}//if (TypeOfGrid == OP_SELLSTOP || TypeOfGrid == Both)
if (TypeOfGrid == Limit || TypeOfGrid == Both)
{
SendSellGrid(symbol, OP_SELLLIMIT, bid, Lot, GridSize );
}//if (TypeOfGrid == OP_BUYSTOP || TypeOfGrid == Both)
}//if (result)
}//if (SellSignal)
//This takes care of grid trading only.
if (!SendImmediateMarketTrade && !SendPendingTrades)
if (UseGridTrading)
{
if (BuySignal)
{
if (TypeOfGrid == Stop || TypeOfGrid == Both)
{
SendBuyGrid(symbol, OP_BUYSTOP, ask, Lot, GridSize );
}//if (TypeOfGrid == Stop || TypeOfGrid == Both)
if (TypeOfGrid == Limit || TypeOfGrid == Both)
{
SendBuyGrid(symbol, OP_BUYLIMIT, ask, Lot, GridSize );
}//if (TypeOfGrid == Limit || TypeOfGrid == Both)
}//if (BuySignal)
if (SellSignal)
{
if (TypeOfGrid == Stop || TypeOfGrid == Both)
{
SendSellGrid(symbol, OP_SELLSTOP, bid, Lot, GridSize );
}//if (TypeOfGrid == OP_SELLSTOP || TypeOfGrid == Both)
if (TypeOfGrid == Limit || TypeOfGrid == Both)
{
SendSellGrid(symbol, OP_SELLLIMIT, bid, Lot, GridSize );
}//if (TypeOfGrid == OP_BUYSTOP || TypeOfGrid == Both)
}//if (SellSignal)
}//if (UseGridTrading)
}//if (BuySignal || SellSignal)
}//if (OpenTrades < MaxTradesAllowed)
}//if (TimeCurrent() >= TimeToStartTrading[PairIndex])
}//if (!StopTrading)
}//End void CanWeSendTrades(string symbol, int signal)
Thanks for your persistence c1borg.
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.
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.
- c1borg
- Trader
- Posts: 456
- Joined: Sun Aug 14, 2016 5:09 pm
Desky. TDesk's trading drone.
As usual you come up with the goodsSteveHopwood » Mon Jan 28, 2019 8:54 pm wrote:V 2q is in post 1, with the fix for the pending orders stuff that c1borg posted in the 'Confused' thread - http://www.stevehopwoodforex.com/phpBB3 ... 29#p165929
I could not believe the bollocks I had coded when I looked at it in response to c1borg's thread.
I do have an excuse. Any of us who have developed as self-taught coders will find the same thingy here. How to code something does not tend to be difficult - CrapQl4 is a very simple language. It is the what to code that can be a bit of a bugger to work out.
It is quite some time since I last worked out the what to code quite as badly as this little lot.
There was no need to update the user guide. The new inputs should be self-explanatory.
DIYers, do this:
Do a search for: "enum PendingTradeTypes". It is only a few lines down. Copy this over the top of the existing code block:Then do a search for: "extern PendingTradeTypes TypeOfPendingTrade=". I cannot remember what the original default was, so change it to:Code: Select all
enum PendingTradeTypes { Stop_order_only, Limit_order_only, Stop_and_Limit_orders, };
extern PendingTradeTypes TypeOfPendingTrade=Stop_order_only;
Then search for, "void CanWeSendTrades(string symbol, int pairIndex, int signal)" to navigate to the relevant function. Easiest is to simply copy this over the top of the existing function:Thanks for your persistence c1borg.Code: Select all
void CanWeSendTrades(string symbol, int pairIndex, int signal) { bool result = false; if (!hedged) if (!StopTrading) { if (TimeCurrent() >= TimeToStartTrading[pairIndex]) { if (OpenTrades < MaxTradesAllowed) { if (BuySignal || SellSignal) { if (BuySignal) { //Immediate market trade if (SendImmediateMarketTrade) result = LookForTradingOpportunities(symbol, pairIndex, OP_BUY); //Pending orders if (SendPendingTrades) { if (TypeOfPendingTrade == Stop_order_only) result = LookForTradingOpportunities(symbol, pairIndex, OP_BUYSTOP); if (TypeOfPendingTrade == Limit_order_only) result = LookForTradingOpportunities(symbol, pairIndex, OP_BUYLIMIT); if (TypeOfPendingTrade == Stop_and_Limit_orders) { result = LookForTradingOpportunities(symbol, pairIndex, OP_BUYSTOP); Sleep(5000);//Give the platform time to catch up result = LookForTradingOpportunities(symbol, pairIndex, OP_BUYLIMIT); }//if (TypeOfPendingTrade == Stop_and_Limit_orders) }//if (SendPendingTrades) if (UseGridTrading && (SendImmediateMarketTrade || SendPendingTrades)) if (result) { if (TypeOfGrid == Stop || TypeOfGrid == Both) { SendBuyGrid(symbol, OP_BUYSTOP, ask, Lot, GridSize ); }//if (TypeOfGrid == OP_BUYSTOP || TypeOfGrid == Both) if (TypeOfGrid == Limit || TypeOfGrid == Both) { SendBuyGrid(symbol, OP_BUYLIMIT, ask, Lot, GridSize ); }//if (TypeOfGrid == OP_BUYSTOP || TypeOfGrid == Both) }//if (result) }//if (BuySignal) if (SellSignal) { //Immediate market trade if (SendImmediateMarketTrade) result = LookForTradingOpportunities(symbol, pairIndex, OP_SELL); //Pending orders if (SendPendingTrades) { if (TypeOfPendingTrade == Stop_order_only) result = LookForTradingOpportunities(symbol, pairIndex, OP_SELLSTOP); if (TypeOfPendingTrade == Limit_order_only) result = LookForTradingOpportunities(symbol, pairIndex, OP_SELLLIMIT); if (TypeOfPendingTrade == Stop_and_Limit_orders) { result = LookForTradingOpportunities(symbol, pairIndex, OP_SELLSTOP); Sleep(5000);//Give the platform time to catch up result = LookForTradingOpportunities(symbol, pairIndex, OP_SELLLIMIT); }//if (TypeOfPendingTrade == Stop_and_Limit_orders) }//if (SendPendingTrades) if (UseGridTrading && (SendImmediateMarketTrade || SendPendingTrades)) if (result) { if (TypeOfGrid == Stop || TypeOfGrid == Both) { SendSellGrid(symbol, OP_SELLSTOP, bid, Lot, GridSize ); }//if (TypeOfGrid == OP_SELLSTOP || TypeOfGrid == Both) if (TypeOfGrid == Limit || TypeOfGrid == Both) { SendSellGrid(symbol, OP_SELLLIMIT, bid, Lot, GridSize ); }//if (TypeOfGrid == OP_BUYSTOP || TypeOfGrid == Both) }//if (result) }//if (SellSignal) //This takes care of grid trading only. if (!SendImmediateMarketTrade && !SendPendingTrades) if (UseGridTrading) { if (BuySignal) { if (TypeOfGrid == Stop || TypeOfGrid == Both) { SendBuyGrid(symbol, OP_BUYSTOP, ask, Lot, GridSize ); }//if (TypeOfGrid == Stop || TypeOfGrid == Both) if (TypeOfGrid == Limit || TypeOfGrid == Both) { SendBuyGrid(symbol, OP_BUYLIMIT, ask, Lot, GridSize ); }//if (TypeOfGrid == Limit || TypeOfGrid == Both) }//if (BuySignal) if (SellSignal) { if (TypeOfGrid == Stop || TypeOfGrid == Both) { SendSellGrid(symbol, OP_SELLSTOP, bid, Lot, GridSize ); }//if (TypeOfGrid == OP_SELLSTOP || TypeOfGrid == Both) if (TypeOfGrid == Limit || TypeOfGrid == Both) { SendSellGrid(symbol, OP_SELLLIMIT, bid, Lot, GridSize ); }//if (TypeOfGrid == OP_BUYSTOP || TypeOfGrid == Both) }//if (SellSignal) }//if (UseGridTrading) }//if (BuySignal || SellSignal) }//if (OpenTrades < MaxTradesAllowed) }//if (TimeCurrent() >= TimeToStartTrading[PairIndex]) }//if (!StopTrading) }//End void CanWeSendTrades(string symbol, int signal)![]()
![]()
I cannot test every permutation available to Desky, or consider every moment of personal lunacy. I rely on the likes of you to point them out.
![]()
- c1borg
- Trader
- Posts: 456
- Joined: Sun Aug 14, 2016 5:09 pm
Desky. TDesk's trading drone.
Early days as regards to testing ver q but so far only getting Buy side trades and orders, no Sell? Will report back later.
Update..... Sell trades working :hi:
Update..... Sell trades working :hi:
Last edited by c1borg on Tue Jan 29, 2019 9:36 am, edited 1 time in total.