creating and calling a string function

Created at 24 Oct 2018, 07:48
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
alexander.n.fedorov's avatar

alexander.n.fedorov

Joined 02.01.2018

creating and calling a string function
24 Oct 2018, 07:48


Dear Panagiotis

I am trying to create a string function

 

   #region Martingale Status
        private  string MartStatus(string resul)
        {
            for (int i =1; i < 10; i++)
            {
                if (bb.Main.Last(i) < maSlow.Result.Last(i) && maSlow.Result.Last(i) < maSlow.Result.Last(i + 1))
                {
                    resul = "sell";
                }
                else if (bb.Main.Last(i) > maSlow.Result.Last(i) && maSlow.Result.Last(i) > maSlow.Result.Last(i + 1))
                {
                    resul = "buy";
                }
                else
                {
                    resul = "noTrade";
                }
            }
            return resul;
        }
        #endregion

 

But it does not seem to work on a call side:

Please, advise,

 

Best Regards,

 

Sasha

 

 

 


@alexander.n.fedorov
Replies

lec0456
24 Oct 2018, 09:01

Your function is returning a string but it is not using a string.  you don't need to pass in resul.  Just use empty parenthesis ()


@lec0456

alexander.n.fedorov
24 Oct 2018, 09:12

Thanks a lot! That is what i finally come up with by the morning :)

 


@alexander.n.fedorov

alexander.n.fedorov
25 Oct 2018, 02:59

RE:

lec0456 said:

/Your function is returning a string but it is not using a string.  you don't need to pass in resul.  Just use empty parenthesis ()

Dear  lec0456. I think I whould really want to talk with you about that issue. My skype is alexander.n.fedorov

If you don't mnd, text me when it would be a good time to talk

Regards.

Alexander 


@alexander.n.fedorov