Information
Username: | oleh.mudryi |
Member since: | 02 Aug 2022 |
Last login: | 02 Aug 2022 |
Status: | Active |
Activity
Where | Created | Comments |
---|---|---|
Algorithms | 1 | 4 |
Forum Topics | 0 | 0 |
Jobs | 0 | 0 |
Last Algorithm Comments
Okay. I used debugger and I see error on ClosePosition
the NullReferenceException indicates that your code is trying to work with an object that has a null value as its reference
Okay, thanks.
I used your code and it continue to stop after one bar.
I think something wrong with ClosePosition and bot can't repeat cycle
OnTick or OnBar
I need bot that can work 24/7. And if it turn off on next bar, this is bullshit.
I see what you have chenged:
1) FullAccess
2) protected override void OnBar()
3) if (close_buy)
ClosePosition(buy_position);
But it didn't resolve main problem.
Thanks for reccomendations. I will try to find problem in debugger
Hi, thanks for your reply.
Try to backtest it.
Bot stops on next bar - this is the problem.
If i take away function ClosePosition - bot works
So I think the problem is with it
It stops my bot without any mistakes in code or build
It is hard to find mistake
Okay. I have found how to resolve it
var buy_position = Positions.FindAll("order_buy", SymbolName, TradeType.Buy);
var sell_position = Positions.FindAll("order_sell", SymbolName, TradeType.Sell);
foreach (var position in buy_position)
{
if (close_buy)
ClosePosition(position);
}
foreach (var position in sell_position)
{
if (close_sell)
ClosePosition(position);
}