Order Trigger Trading

Created at 12 Oct 2017, 22:19
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!
EM

EmperorCy

Joined 12.10.2017

Order Trigger Trading
12 Oct 2017, 22:19


Hi to all,
first of all i apologize if someone have the same question with me. I make a short search but i didn't find something.

I trade on H1 chart and i will like to trigger my order after close bar price is under a value, not when the price is under the value.
eg. I will like to make an order when the bar closed below of 1,09.
At 10:55 the price closed on 1,091.
Now when at 11:15 the price go down to 1.085 and the order is trigger.
But i want to trigger the order if at 12:01 previous bar closed below my trigger price.

Could any one help me if is that possible or i must make a source with apis?

Best Regards,
EmperorCy


@EmperorCy
Replies

PanagiotisCharalampous
13 Oct 2017, 15:34

Hi EmperorCy,

Thanks for posting in our forum. It is not clear what you mean when you say " i must make a source with apis?". However, from what I understand from your description, what you want to do is possible in a cBot. See an example below

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 NewcBot : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }
        protected override void OnStart()
        {
        }

        protected override void OnBar()
        {
            if ( MarketSeries.Close.Last(1) < 1.09)
                ExecuteMarketOrder(TradeType.Buy, Symbol, 1000);
        }

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

This example executes a market order when the close value of the previous candle is lower than 1.09.

Best Regards,

Panagiotis


@PanagiotisCharalampous

EmperorCy
17 Oct 2017, 15:17

Thank you Panagioti,

i appreciate for example, it's help me to build own for my strategy.

Best Regards,
EmperorCy


@EmperorCy