Topics
18 Mar 2021, 20:36
 1
 1186
 3
Replies

Martin_I
23 Dec 2020, 10:07

RE:

Hi and thanks for your help.

Now i get this Error,  when i have not enough margin for buying:

23/12/2020 10:02:46.796 | Norse Piprunner, EURUSD, m1 | Crashed in OnError with NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.

 

Greetings

Martin


@Martin_I

Martin_I
22 Dec 2020, 18:20

RE: RE:

Hello,

i have still the Problem, but i tried an other way.

Is it Possible to decide if its a BUY- or a SELL-ORDER.
When it is a NoMoneyError on the BUY site do this, when it is a NoMoney-Error on the Sell-Site do this?

I think there is an Error in there  ---  if (position.TradeType == TradeType.Buy)

 

This is my Error-Code


        protected override void OnError(Error error)
        {
                switch (error.Code)
                {
                        case ErrorCode.BadVolume: Print("Bad Volume");
                        break;
                        case ErrorCode.TechnicalError:Print("Technical Error");
                        break;
                        case ErrorCode.NoMoney:
                            if (position.TradeType == TradeType.Buy)
                            {
                                Kaufen = false;
                                Print("FEHLER - NO MONEY - KAUFEN = FALSE");
                            }
                            if (position.TradeType == TradeType.Sell)
                            {
                                Verkaufen = false;
                                Print("FEHLER - NO MONEY - VERKAUFEN = FALSE");
                            }
                        break;
                        case ErrorCode.Disconnected: Print("Disconnected");
                        break;
                        case ErrorCode.MarketClosed: Print("Market Closed");
                        break;
                }
        }


@Martin_I

Martin_I
17 Dec 2020, 13:11 ( Updated at: 17 Dec 2020, 13:44 )

RE:

Hi,

and thank for your response.

I know the Error "NOT_ENOUGH_MONEY".
The Bot creates this Error on every Tick and the Broker called me, to stop the Bot.
My Problem is now, how to write the Programm, to avoid this Error --- ON THE SERVERSITE ---

I need to check the BUY-Margin / SELL-Margin before the Bots does 
                TradeResult result = ExecuteMarketOrder(TrdTp, Symbol, iVol, Label, 0, 0, 0, "smart_grid");
I would do this with an If-Loop ... but how ????

If Symbol.Margin.Buy ... Symbol.Margin ... ??? I run out of Ideas :(

My Bot is running 24/7 with expotentiell Lots. I wish a had so much Money that the Bot havent to stop ;)


@Martin_I