Topics
Replies
firemyst
08 Aug 2023, 06:19
RE: RE: placelimitorder success
luca.tocchi said:
firemyst said:
What do you mean by “activated”? DO you mean when the order is actually executed? If so, just check the trade result:
TradeResult r = PlaceStopOrder(TradeType.Buy, SymbolName, volumeInUnits, Symbol.Bid + 15);
if (r.IsSuccessful) {
////
}
I mean when the pending order turns into position.
Then do what I suggested. If the trade result is successful, you know you have a position.
@firemyst
firemyst
07 Aug 2023, 23:58
If there's losing trades, you may want to consider leaving it as it is so you have to manually restart it. This does two things:
- makes sure your account doesn't blow up if it keeps continuously losing more than 3 trades
- gives you a chance to review the trades and what's happening.
If you really want it to start again the next day, you can try this:
- reset the losing count to 0
- keep track of the time. When your new day starts, allow the bot to proceed again. Something like this:
if (!allowTrades && Server.Time > 9am)
{
allowTrades = true;
}
In your OnTick method:
if (allowTrades)
{
////rest of method
}
else
return;
and you'd have to update your code:
if (losercount == 3)
{
allowTrades = false;
Stop();
}
@firemyst
firemyst
07 Aug 2023, 00:13
You might get your wish if you post in the correct forum:
https://ctrader.com/forum/suggestions
@firemyst
firemyst
30 Jul 2023, 08:45
One issue you'll have is the trendlines are overwriting each other because you're giving them the same names.
Change the line:
ObjUp = string.Format("UpTrendLine");
to be this instead:
ObjUp = string.Format("UpTrendLine") + index.toString();
Do the same for the down trend line. This way, every up obj and down obj will have unique names so they won't overwrite each other.
@firemyst
firemyst
08 Aug 2023, 23:42
@Spotware please delete this spam
@firemyst