PanagiotisCharalampous's avatar
PanagiotisCharalampous
26 follower(s) 0 following 1006 subscription(s)
Replies

PanagiotisCharalampous
26 Mar 2024, 06:44

Hi there,

What exactly is not working? What do you expect to happen and what happens instead?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
26 Mar 2024, 06:42

RE: RE: RE: RE: Sell Stop order position closed with stop loss higher than intended

nubfight said: 

PanagiotisCharalampous said: 

nubfight said: 

PanagiotisCharalampous said: 

Hi there, 

You seem to set the stop loss and take profit in relative prices, while they should be set in pips e.g. 

PlaceStopOrder(TradeType.Sell, SymbolName, ncontracts, entryPrice, "", SellStopLossAfterPips,                                      SellTakeProfitAfterPips, expiry);

Best regards,

Panagiotis

Hi I forgot to reply to this but I tried using this but it's giving the same results. I also have been setting it in pips rather than relative prices before already

Well what you have provided above is evidently wrong. If you fix the code, try it again and you still have issues, feel free to repost it and we can have a look

Hi there! I double checked my code and parameters and I don't think I am placing it in their relative prices but pips instead, I'll leave the code below along with the parameters I placed

 

using System;using System.Linq;using cAlgo.API;using cAlgo.API.Indicators;using cAlgo.API.Internals;using cAlgo.Indicators;using System.Collections.Generic;namespace cAlgo.indicators{    [Robot(TimeZone = TimeZones.CentralPacificStandardTime, AccessRights = AccessRights.None)]    public class Chasm : Robot    {            string version_number = "1.0";        // Declarations        private int currenthour;        private int currentminute;        private string stringdate;        private bool is_position_open;        private string scenario;        private double today_open;        private double today_high;        private double today_low;        private double bid_price;        private double ask_price;        private double yesterday_close;        private double yesterday_high;        private double yesterday_low;        private int kindex;                [Parameter("N. Contracts", DefaultValue = 1, MinValue = 0)]        public int ncontracts { get; set; }        // Additional parameters        [Parameter("Order Time (HH:mm)", DefaultValue = "01:28")]        public string orderTime { get; set; }                       [Parameter("Order Expiry (Minutes)", DefaultValue = 2, MinValue = 1)]        public double orderTimer { get; set; }                [Parameter("Stop Loss Distance (Pips)", DefaultValue = 15, MinValue = 0, Group = "Buy Order Settings")]        public double BuyStopLossAfterPips { get; set; }                     [Parameter("Take Profit (Pips)", DefaultValue = 40, MinValue = 0, Group = "Buy Order Settings")]        public double BuyTakeProfitAfterPips { get; set; }        [Parameter("Stop Loss Distance (Pips)", DefaultValue = 15, MinValue = 0, Group = "Sell Order Settings")]        public double SellStopLossAfterPips { get; set; }                [Parameter("Take Profit (Pips)", DefaultValue = 40, MinValue = 0, Group = "Sell Order Settings")]        public double SellTakeProfitAfterPips { get; set; }        protected override void OnStart()        {            is_position_open = false;            kindex = 0;            Positions.Closed += PositionsOnClosed;            Print("Chasm {0} Started", version_number);            Print("Server time is {0}", Server.Time.AddHours(0));            Timer.Start(60);                    }        protected override void OnBar()        {            kindex = Bars.ClosePrices.Count - 1;            today_open = Bars.OpenPrices[kindex];            yesterday_close = Bars.ClosePrices[kindex - 1];            yesterday_high = Bars.HighPrices[kindex - 1];            yesterday_low = Bars.LowPrices[kindex - 1];            if (today_open > yesterday_close) scenario = "GAPUP";            else if (today_open < yesterday_close) scenario = "GAPDOWN";            else scenario = null;        }        protected override void OnTimer()        {            today_high = Bars.HighPrices[kindex];            today_low = Bars.LowPrices[kindex];                        // Time Vars            stringdate = Server.Time.ToString("HH:mm");            currenthour = int.Parse(stringdate.Substring(0, 2));            currenthour = Convert.ToInt32(stringdate.Substring(0, 2));            currentminute = int.Parse(stringdate.Substring(3, 2));            currentminute = Convert.ToInt32(stringdate.Substring(3, 2));                        bid_price = Symbol.Bid;            ask_price = Symbol.Ask;                        if (scenario != null)            {                if (stringdate.Equals(orderTime)) ExecuteOrder();            }        }        protected override void OnStop()        {            Print("Chasm Stopped");        }                                private void PositionsOnClosed(PositionClosedEventArgs args)        {            var pos = args.Position;            Print("Position closed with €{0} profit", pos.GrossProfit);            is_position_open = false;        }                 private void ExecuteOrder()        {            if (is_position_open) return;                        double lastLowPrice = Bars.LowPrices.Last(1);            double lastHighPrice = Bars.HighPrices.Last(1);            DateTime expiry = Server.Time.AddMinutes(orderTimer);            var entryPrice = lastLowPrice;            TradeResult sellResult = PlaceStopOrder(TradeType.Sell, SymbolName, ncontracts, entryPrice, "", SellStopLossAfterPips,                                      SellTakeProfitAfterPips, expiry);                        if (sellResult.IsSuccessful) Print("Sell Stop Order placed at: " + entryPrice);            else Print("Failed to place Sell Stop Order: " + sellResult.Error);            entryPrice = lastHighPrice;            TradeResult buyResult = PlaceStopOrder(TradeType.Buy, SymbolName, ncontracts, entryPrice, "", BuyStopLossAfterPips,                                     BuyTakeProfitAfterPips, expiry);                                                if (buyResult.IsSuccessful) Print("Buy Stop Order placed at: " + entryPrice);            else Print("Failed to place Buy Stop Order: " + buyResult.Error);                         is_position_open = true;         }    }}

Can you tell us your broker as well?


@PanagiotisCharalampous

PanagiotisCharalampous
26 Mar 2024, 06:37

Hi there,

You can find some brokers here

https://www.spotware.com/featured-ctrader-brokers

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
26 Mar 2024, 06:36

Hi there,

If you need to run two different cBots on two different accounts, you need to have two instances open.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
25 Mar 2024, 08:40

RE: RE: About prices used in real-time SMA

bolatfx said: 

PanagiotisCharalampous said: 

Hi there,

It uses the last x prices defined by the MA period including the current one.

Best regards,

Panagiotis

thank you. I use the closing price of the candlestick for SMA calculation, but in real time, the candlestick is not completed yet. What should I use instead of the closing price in such a case?

The current bid price


@PanagiotisCharalampous

PanagiotisCharalampous
25 Mar 2024, 07:38

RE: RE: Sell Stop order position closed with stop loss higher than intended

nubfight said: 

PanagiotisCharalampous said: 

Hi there, 

You seem to set the stop loss and take profit in relative prices, while they should be set in pips e.g. 

PlaceStopOrder(TradeType.Sell, SymbolName, ncontracts, entryPrice, "", SellStopLossAfterPips,                                      SellTakeProfitAfterPips, expiry);

Best regards,

Panagiotis

Hi I forgot to reply to this but I tried using this but it's giving the same results. I also have been setting it in pips rather than relative prices before already

Well what you have provided above is evidently wrong. If you fix the code, try it again and you still have issues, feel free to repost it and we can have a look


@PanagiotisCharalampous

PanagiotisCharalampous
25 Mar 2024, 07:34

RE: Why the statement no longer have the save option?

kepsta_123 said: 

This feature was definitely in the Web based version as I used it a lot and it was extremally useful.

Is there an easy way to convert the statements as printed now into csv format ? 

Hi there,

It's a bug and will be fixed soon.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
25 Mar 2024, 07:31

Hi there,

It uses the last x prices defined by the MA period including the current one.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
25 Mar 2024, 07:28

Hi there,

This happens because you do not acquire the text box value anywhere. See below

            var stopLossPips = GetValueFromInput(StopLossInputKey, 0);
            var takeProfitPips = GetValueFromInput(TakeProfitInputKey, 0);

            string label = LabelImputKey;
            string comment = CommentImputKey;

You acquire the sl and tp from the text boxes but you use the default label and comment.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
25 Mar 2024, 07:22

RE: RE: Advanced Take Profit calculations are wrong

matveualekseev03 said: 

PanagiotisCharalampous said: 

Hi timosilver,

Your comment does not make much sense to me. Can you provide examples of what do you thing is wrong?

Best regards,

Panagiotis

Hi, I have the same problem. The take profit is 2 times less than it should be or so. For example, I place an order with a market with a fixed take of 1 to 4, after the price reaches the take, my profit is not 1 to 4, but 1 to 2 or 1 to 3. It's smaller than it should be. Help please

Hi there,

You need to refresh your math a bit :) It would be 1:4 if you started from 0%. But you start from 100% so it is 1:3.


@PanagiotisCharalampous

PanagiotisCharalampous
25 Mar 2024, 07:18

Hi there,

cTrader does not add brokers to the platform. It's the brokers that add platforms to their offerings. So it is better to talk to the broker regarding this.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
25 Mar 2024, 07:16

Hi there,

We did not change anything, we just propagate what we receive from the liquidity providers. Each liquidity provider has its own logic in streaming price feeds.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
25 Mar 2024, 07:10

RE: RE: Is it possible in C bot?

flappiyt said: 

firemyst said: 

TO change the volume, use the ModifyVolume ;

To close a position entirely, use the Close method.

Hi firemyst 

I have no idea how to use ModifyVolume 

Could you please help me to implement it into my code? 

I tried something like this but it fails 

if (!isPartialCloseExecuted && isAlreadyInTrade)
                    {
                        double closePositionSize = positionSize * 0.5;
                        
                        public abstract TradeResult ModifyVolume(double closePositionSize)

                        isPartialCloseExecuted = true;
                    }

Hi there,

Here is an example

            var position  = ExecuteMarketOrder(TradeType.Sell, SymbolName, 2000).Position;
            position.ModifyVolume(1000);

@PanagiotisCharalampous

PanagiotisCharalampous
25 Mar 2024, 06:53

Hi there,

You can develop a simple cBot for this (or have a professional develop it for you). This is not something that will find it's way as a built in feature of the platform.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
25 Mar 2024, 06:51

Hi there,

Please provide more information like your cBot's code, your broker and optimization dates, settings and parameters so that we can reproduce the problem.

Best regards,

Panagiotis


 


@PanagiotisCharalampous

PanagiotisCharalampous
25 Mar 2024, 06:50

Hi there,

Trading times are configured by brokers. Please contact your broker regarding this matter.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
25 Mar 2024, 06:49

Hi there,

Symbols are offered by brokers. Please contact your broker regarding this matter.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
25 Mar 2024, 06:48

Hi there,

Please provide more information about this issue e.g. broker, symbol, screenshots and/or videos demonstrating what you are looking at.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
25 Mar 2024, 06:46

Hi there,

You need to provide more information on your request if you expect to receive any help. Which trade options panel are you referring to? What do you expect to happen and what happens instead?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
23 Mar 2024, 05:56

Hi there,

Your code logic is wrong. Your code does not do the below

I would like the buy/sell position to start as soon as the oposite SAR is touched

Your code just places trades when the price is above or below the current psar value, which is always true. You should check for crosses instead e.g. the close price being above while the open price is below.

Best regards,

Panagiotis 


@PanagiotisCharalampous