who can help me correct this code

Created at 19 Dec 2021, 16:18
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!
91

910247359

Joined 19.12.2021

who can help me correct this code
19 Dec 2021, 16:18


MT4 expert code to cTrader

 

 

int SellStopPoint()

{

   double spread = (MarketInfo(Symbol(), MODE_SPREAD))*Point;

   double sto=High[iHighest(NULL,0,MODE_HIGH,7,0)]+1.5*spread;

   int    poi=(sto-Bid)/Point;

   return(poi);

}

int BuyStopPoint()

   double sto=Low[iLowest(NULL,0,MODE_LOW,7,0)];

   int    poi=(Ask-sto)/Point;

   return(poi);

}


@910247359
Replies

amusleh
20 Dec 2021, 09:38

Hi,

Not sure what those functions return, but I tried my best:

        private int SellStopPoint()
        {
            double sto = Bars.HighPrices.Maximum(7) + 1.5 * Symbol.Spread;

            int poi = Convert.ToInt32((sto - Bid) * Math.Pow(10, Symbol.Digits));

            return (poi);
        }

        private int BuyStopPoint()
        {
            double sto = Bars.LowPrices.Minimum(7) + 1.5 * Symbol.Spread;

            int poi = Convert.ToInt32((Ask - sto) * Math.Pow(10, Symbol.Digits));

            return (poi);
        }

If there something wrong please correct it based on cTrader automate API: 

 


@amusleh

910247359
20 Dec 2021, 10:36 ( Updated at: 20 Dec 2021, 10:40 )

RE: MT4 expert code to cTrader

@algodeveloper

re:Ahmad Noman Musleh

 

would you plz tell me your email address or would you send me an email at   910247359@qq.com, I want give you my whole cBot souce code which is almost done, and you can work it out , this is the MT4 trading panel i use, I hope you can realize it in the cTrader, perhaps it's also usful to your trade

 


@910247359

910247359
20 Dec 2021, 10:38 ( Updated at: 20 Dec 2021, 10:39 )

RE:


@910247359

amusleh
20 Dec 2021, 13:15

Hi,

You can post a job request or ask one of our consultants to do it for you.


@amusleh