Order Trigger Trading

12 Oct 2017, 22:19Order Trigger Trading#1
EmperorCyposts: 2since: 12 Oct 2017

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

13 Oct 2017, 15:34#2
Panagiotis Charalampousposts: 160since: 13 Jan 2017

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


Head of Community Management at cTrader
17 Oct 2017, 15:17#3
EmperorCyposts: 2since: 12 Oct 2017

Thank you Panagioti,

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

Best Regards,
EmperorCy