following bot free

by al-n in category Trend at 03/08/2022
Description

this is just a simple bot that opens trades buy/sell and trails with sl in endles loop.

Warning! Executing the following cBot may result in loss of funds. Use it at your own risk.
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.
Formula / Source Code
Language: C#
Trading Platform: cAlgo
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class TrailingStopLossSample : Robot
    {
        [Parameter("VolumeInLots", DefaultValue = 1)]
        public double VolumeInLots { get; set; }
        [Parameter("Buy")]
        public bool Buy { get; set; }
        [Parameter("Stop Loss", DefaultValue = 5)]
        public double StopLoss { get; set; }
        [Parameter("Trigger When Gaining", DefaultValue = 1)]
        public double TriggerWhenGaining { get; set; }
        [Parameter("Trailing Stop Loss Distance", DefaultValue = 1)]
        public double TrailingStopLossDistance { get; set; }
        [Parameter("Step (pips)", DefaultValue = 5)]
        public double Step { get; set; }

        private double _highestGain;
        private bool _isTrailing;



        protected override void OnStart()
        {
        }



        protected override void OnTick()
        {
            // checking if any position are open
            if (Positions.Count == 0)
            {

                //Execute a market order based on the direction parameter
                ExecuteMarketOrder(Buy ? TradeType.Buy : TradeType.Sell, Symbol, VolumeInLots * 100000, "SampleTrailing", StopLoss, null);
                //Set the position's highest gain in pips
                _highestGain = Positions[0].Pips;

            }

            {
                var position = Positions.Find("SampleTrailing");

                if (position == null)
                {
                    Stop();
                    return;
                }
                //If the trigger is reached, the robot starts trailing
                if (position.Pips >= TriggerWhenGaining)
                {
                    //Based on the position's direction, we calculate the new stop loss price and we modify the position
                    if (position.TradeType == TradeType.Buy)
                    {
                        var newSLprice = Symbol.Ask - (Symbol.PipSize * TrailingStopLossDistance);
                        if (newSLprice > position.StopLoss)
                        {
                            ModifyPosition(position, newSLprice, null);
                        }
                    }
                    else
                    {
                        var newSLprice = Symbol.Bid + (Symbol.PipSize * TrailingStopLossDistance);
                        if (newSLprice < position.StopLoss)
                        {
                            ModifyPosition(position, newSLprice, null);
                        }
                    }
                    TriggerWhenGaining += Step;
                }
            }
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}
Comments

stephaniesteph86 - August 06, 2022 @ 22:07

I've been looking for tips to earn money via stocks for such a long time now. Some there on online assignment help have really inspired me to quite an extent. Maybe I'll go with them

hankfreid - August 10, 2022 @ 13:37

When you make a buy, you get standard Delta - HPE Storage Solutions refreshes from the organization on your forthcoming test. It is to keep you informed on the progressions in HP HPE0-J69 Exam Dumps, test organization and strategy (if any) also in time. The fantastic HPE0-J69 concentrate on material promises you a splendid outcome in HP test in first endeavor.

Dumpsleader unconditional promise is the best proof of its certainty on the adequacy of its Delta - HPE Storage Solutions practice test dumps. The productive HP online group is consistently prepared to direct you and answer your HP Certification related inquiries instantly. Our HPE0-J69 practice questions accompanies a free Delta - HPE Storage Solutions demo. You can download it on your PC to look at the nature of other HP item with some other accessible HP Certification source with you.

haxegod771 - August 11, 2022 @ 08:16

One more choice for missing teeth are dental implants. These are teeth that are really embedded into your jaw how your other teeth are. Extensions https://www.dentista.com.au/check-up-and-clean-airflow and halfway false teeth are consistently an extraordinary choice, as they will permit you to dispose of the vacant tooth spaces.

haxegod771 - August 11, 2022 @ 10:57

In the high level world, it is one of the modules which give the more prominent advantages to the client. Whether you are showcasing expert pompandcircumstancepr business, assuming individuals find opportunity to find out about web-based entertainment, the incredible accomplishment for their business can be accomplished through the strategy for direction.

haxegod771 - August 11, 2022 @ 11:41

There is a great deal of opportunity to get better, and the thoughts that structure the premise of behavioral science present an imaginative tool beworks stash of assets to utilize. A New York Times article highlighted a shrewd discourse by Richard Thaler, co-writer of Nudge.

haxegod771 - August 11, 2022 @ 12:29

Waterways, for example, the Spey and Livet stream from the Cairngorm mountains and their waters' immaculateness is consecrated by suntory taste Hibiki distillers. Speyside whiskies are light and sweet, exquisite and complex.

haxegod771 - August 11, 2022 @ 12:45

Beside the expansion in the quantity of accessible conservative models, value, styling and usefulness are extra factors that add to the www.toptradeauto.com reduced vehicle share development.

haxegod771 - August 11, 2022 @ 12:59

Numerous straightforward lawful issues happen consistently and a greater part of them includes civil litigation. Civil litigation is any question civil litigation lawyers Etobicoke between at least two gatherings, people, or organizations, colleagues, that has dropped out and which can't be settled without a courtroom.

haxegod771 - August 11, 2022 @ 13:11

Not to stress, this article will cover what you really want to be aware a basic aide, maybe, to picking an eating regimen meal home delivery meal prep containers toronto administration. This is a term for any help that sends you normal meals, snacks, bars, shakes, or any kind of food to your home to assist you with getting in shape.

haxegod771 - August 11, 2022 @ 13:22

Prior to purchasing, verify what innovation is related with the items. Items utilizing a similar innovation ought to cooperate notwithstanding empire custom homes various makers. A smart home auto framework coordinates all gadgets in your home with one another either wiring or remote framework.

haxegod771 - August 11, 2022 @ 13:34

Disregarding playing it safe and care, a few wounds will undoubtedly occur. A portion of the eminent Physiotherapy restoration focuses chirothin assist the competitor with recuperating at a quicker rate without the injury turning out to be excessively confounded.

haxegod771 - August 11, 2022 @ 13:43

Despite the fact that you might anticipate that your divorce lawyer should deal with all parts of your divorce, there are things you can do how much does a divorce lawyer cost in ontario to make the cycle simpler on yourself and your lawyer.

haxegod771 - August 11, 2022 @ 13:48

To your top choices as I update you with the most recent news and bits of hearsay in the website streamlining industry ordinary. The impacts of guaranteed seo vancouver terrible site improvement are crushing and extremely discouraging.

haxegod771 - August 11, 2022 @ 13:52

Whether you make your cheesecake at home or buy a mail request cheesecake, you need to serve your sweet in style. Cheesecakes are rich, tasty best desert Mississauga that merit the best show and serving style. Follow our cheesecake serving tips and you make certain to wow your loved ones.

nickeevans - August 14, 2022 @ 16:19

Use the V Bucks generator bot to generate V Bucks for Fortnite. This generator is a web-based app and works like a charm. And one more thing, it's free!

stephaniesteph86 - August 30, 2022 @ 21:00

If you want Internet access, then that's a different matter. You'll need an ISP connection and a contract for the service. So, if you have a wireless router installed in your home temporary wifi rental, you can create a free WiFi network for other devices to connect to. This is an alternative to using Ethernet for the connection between your device and the router.

ma2388562 - October 03, 2022 @ 11:07

Itu adalah kunjungan pertama saya ke blog anda dan saya sangat antusias dengan artikel-artikel yang anda sajikan. Memberikan pengetahuan yang cukup untuk saya. Terima kasih telah berbagi bermanfaat dan jangan lupa, terus berbagi info bermanfaat: pkv poker

ma2388562 - October 10, 2022 @ 10:49

Postingan yang sangat bagus. Saya baru saja menemukan blog Anda dan ingin mengungkapkan bahwa saya sangat menikmati membaca posting blog Anda. Dengan cara apa pun saya akan berlangganan umpan Anda dan saya berharap Anda segera memposting lagi. Terima kasih banyak atas info yang bermanfaat. judi bola

ma2388562 - October 10, 2022 @ 12:51

Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained! http://nripja.com/uploads/user/2022-10-10-073527.468848slot138-slot-terpercaya-slot88-dan-judi-slot-pakar777.html

sheikhrafay580 - October 26, 2022 @ 15:01

Pretty good post. I have just stumbled upon your blog and enjoyed reading your blog posts very much. I am looking for new posts to get more precious info. Big thanks for the useful info. intervento cataratta padova

mohsinkhatri652 - October 31, 2022 @ 12:16

AAAAAAAAAAAAAAA

jokerdevil3344 - November 10, 2022 @ 13:05

This specific papers fabulous, and My spouse and i like all the perform that you have placed into this. I'm sure you will be building a really useful place. I has been additionally pleased. Good perform! male cartoon characters

citations.burlydumpsters - November 15, 2022 @ 14:44

I enjoy reading your blog. Your post is interesting and enjoyable.

0