Topics
Replies
useretinv
16 Dec 2019, 14:35
RE:
PanagiotisCharalampous said:
Hi useretinv,
I am not sure what do you mean when you say.
to apply new Multi-Symbol Back testing code
This cBot is not a multisymbol cBot. It just trades one symbol. Do you want this cBot to trade on many symbols at the same time?
Best Regards,
Panagiotis
yes , i want this code to trade on many symbols at the same time .
@useretinv
useretinv
02 Aug 2019, 19:20
@useretinv
useretinv
02 Aug 2019, 19:08
Very important
Multi symbols backtest is critical for me now to continue using ctrader. Please do it ASAP. it is very important.@useretinv
useretinv
10 Sep 2018, 16:17
OK , just sample code to start and stop cbot within specified hours , plz
and maximum volume that cbot can use from account
thank you
@useretinv
useretinv
10 Sep 2018, 15:31
RE:
Panagiotis Charalampous said:
Hi useretinv,
In this forum we are trying to help programmers to use cTrader and cAlgo by addressing questions related to the API and the usage of the platform and by providing suggestions in development questions.If you wish me to provide a sample on how to do what you have asked and then adjust the code yourself, I am more than happy to do so.
But understanding what a 300 lines cBot does and making the change you request is a task that could take some hours and can be considered custom development service. In this case, you should contact a professional.
Let me know if want me to provide you with a code sample.
Best Regards,
Panagiotis
yes, i just want a sample code to close all position when max positions is reached , i just posted the full code cause i thought that will make it easy to help if you see the full code . that's all
Similarly here
https://ctrader.com/forum/cbot-support/13700
@useretinv
useretinv
08 Sep 2018, 11:58
. Many thanks Mr.Panagiotis
.IT WORKS
PLZ help me to ADD server hours to Martingle sample code , Open and close cbot Automatically at specified hours
i tryied to put
( if (Server.Time.Hour >= 7 && Server.Time.Hour < 10
( as you advised in ( https://ctrader.com/forum/cbot-support/13565
but it's not working with Sample Martingle Code .plz help
//////////////////////////////////////////
Also i want to Add a simple logic to the code to prevent it opening new positions if the the first position hits the stop loss in the current bar .
for Example : if the code was working on 30min bar chart , and the first position hits a stop loss. don't open new position at the same bar (30min bar ) i want the cbot to wait
another 2 or 3 bars latter to open the new position with the Initial Volume .
/////////////////////////////////////
Also plz i want to add Maximum volume to prevent cbot to doubling position volume with no limit , just add parameter of maximum orders or maximum volume that cbot can use from Account to open position , after reaching the maximum orders , make cbot start over withthe Initial Volume .
ALL IN Martingle Sample code Plz
Many many Thanks in advance, Mr.Panagiotis
// ------------------------------------------------------------------------------------------------- // // This code is a cAlgo API sample. // // This robot is intended to be used as a sample and does not guarantee any particular outcome or // profit of any kind. Use it at your own risk // // All changes to this file will be lost on next application start. // If you are going to modify this file please make a copy using the "Duplicate" command. // // The "Sample Martingale Robot" creates a random Sell or Buy order. If the Stop loss is hit, a new // order of the same type (Buy / Sell) is created with double the Initial Volume amount. The robot will // continue to double the volume amount for all orders created until one of them hits the take Profit. // After a Take Profit is hit, a new random Buy or Sell order is created with the Initial Volume amount. // // ------------------------------------------------------------------------------------------------- using System; using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo.Robots { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class SampleMartingaleRobot : Robot { [Parameter("Initial Volume", DefaultValue = 10000, MinValue = 0)] public int InitialVolume { get; set; } [Parameter("Stop Loss", DefaultValue = 40)] public int StopLoss { get; set; } [Parameter("Take Profit", DefaultValue = 40)] public int TakeProfit { get; set; } private Random random = new Random(); protected override void OnStart() { Positions.Closed += OnPositionsClosed; ExecuteOrder(InitialVolume, GetRandomTradeType()); } private void ExecuteOrder(long volume, TradeType tradeType) { var result = ExecuteMarketOrder(tradeType, Symbol, volume, "Martingale", StopLoss, TakeProfit); if (result.Error == ErrorCode.NoMoney) Stop(); } private void OnPositionsClosed(PositionClosedEventArgs args) { Print("Closed"); var position = args.Position; if (position.Label != "Martingale" || position.SymbolCode != Symbol.Code) return; if (position.GrossProfit > 0) { ExecuteOrder(InitialVolume, GetRandomTradeType()); } else { ExecuteOrder((int)position.Volume * 2, position.TradeType); } } private TradeType GetRandomTradeType() { return random.Next(2) == 0 ? TradeType.Buy : TradeType.Sell; } } }
@useretinv
useretinv
19 Nov 2022, 12:40
RE:
admin said:
i just need to integrate that code to Sample Martingale cBot for purpose to trading it at spasific times
@useretinv