oleh.mudryi's avatar
oleh.mudryi
oleh.mudryi's avatar

Info

Username:oleh.mudryi
Name:oleh.mudryi
Member since: 02 Aug 2022

About

None

Signature

None

Last Algorithm Comments

@Simple EMA Crossover cBot:  03 Aug 2022, 18:53


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); }

@Simple EMA Crossover cBot:  03 Aug 2022, 12:29


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

@Simple EMA Crossover cBot:  03 Aug 2022, 11:29


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

@Simple EMA Crossover cBot:  02 Aug 2022, 19:24


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

Last Forum Posts

@cBot stops after one bar:  03 Aug 2022, 18:52


oleh.mudryi said:

oleh.mudryi said:

I am new one in C# programming and cAlgo.
When i start my cBot, it stops on next bar.

If you try to backtest it, you will see that he stops on next bar. 
If I take away function ClosePosition than 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

See Full code and download bot you can here:
 

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. 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);

}

@cBot stops after one bar:  03 Aug 2022, 17:02


oleh.mudryi said:

I am new one in C# programming and cAlgo.
When i start my cBot, it stops on next bar.

If you try to backtest it, you will see that he stops on next bar. 
If I take away function ClosePosition than 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

See Full code and download bot you can here:
 

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

@cBot stops after one bar:  03 Aug 2022, 11:06


I am new one in C# programming and cAlgo.
When i start my cBot, it stops on next bar.

If you try to backtest it, you will see that he stops on next bar. 
If I take away function ClosePosition than 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

See Full code and download bot you can here:
 

Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.

No uploaded.

Warning! Executing cBots downloaded from this section may result in loss of funds. Use them at your own risk.
free  03 Aug 2022
// I need help here bool close_buy = standart_ema.Result.LastValue > fast_ema.Result.LastValue; bool close_sell = standart_ema.Result.LastValue < fast_ema.Result.LastValue; var buy_position = Positions.Find("order_buy", SymbolName, TradeType.Buy); var sell_position = Positions.Find("order_sell", SymbolName, TradeType.Sell); if (standart_ema.Result.LastValue > fast_ema.Result.LastValue) ClosePosition(buy_position); else if (standart_ema.Result.LastValue < fast_ema.Result.LastValue) ClosePosition(sell_position); I am new one in C# programming and cAlgo. Please help me to close position correctly.  When i start my cBot, it stops on next bar. It is hard to work with ClosePosition() method correctly Can you help me in comment?