Topics
Replies
VHS10
14 Aug 2020, 18:13
How can i block a particular demo account from following me? I know he copies my trades to his own personal account and he does this to avoid paying fees! that is theft and this should not be allowed.
https://ct.icmarkets.com/copy/strategy/11191
@VHS10
VHS10
24 Jun 2020, 17:34
I am quite surprised that cTrader currently has very limited HotKey functions and I think the next version of cTrader should include hotkeys that does the following;
-Places buy or sell market order
-Places different types of limit and sell orders
-Closes all buy orders and/or closes all sell orders too
-To hedge position or open another position in the same direction.
I am sure a lot of people will agree that these will have a significant impact on the performance and efficiency of a Trader, especially the scalpers.
@VHS10
VHS10
24 Jun 2020, 17:33
I am quite surprised that cTrader currently has very limited HotKey functions and I think the next version of cTrader should include hotkeys that does the following;
-Places buy or sell market order
-Places different types of limit and sell orders
-Closes all buy orders and/or closes all sell orders too
-To hedge position or open another position in the same direction.
I am sure a lot of people will agree that these will have a significant impact on the performance and efficiency of a Trader, especially the scalpers.
@VHS10
VHS10
20 Jun 2020, 14:22
RE:
rynfaxy said:
I am also having this question.
You would need a local MT4 EA to Ctrader Cbot copier system like i described above
reach me here ImanTheTrader's telegram
@VHS10
VHS10
15 Jun 2020, 13:46
Hi there,
I have been testing this indicator out and it seems to not be as whole as the MT4 version. I have attached both of the codes for anyone to please to look through and determine what's missing
and possibly put it in order.
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class WaddahAttarExplosion : Indicator
{
[Parameter("Sensetive", DefaultValue = 150)]
public int Sensetive { get; set; }
[Parameter("DeadZonePip", DefaultValue = 30)]
public int DeadZonePip { get; set; }
[Parameter("ExplosionPower", DefaultValue = 3)]
public int ExplosionPower { get; set; }
[Parameter("TrendPower", DefaultValue = 15)]
public int TrendPower { get; set; }
[Output("ind_Trend1", Color = Colors.Lime, PlotType = PlotType.Histogram, Thickness = 4)]
public IndicatorDataSeries ind_Trend1 { get; set; }
[Output("ind_iTrend1", Color = Colors.Red, PlotType = PlotType.Histogram, Thickness = 4)]
public IndicatorDataSeries ind_iTrend1 { get; set; }
[Output("ind_Explo1", Color = Colors.Sienna, Thickness = 2)]
public IndicatorDataSeries ind_Explo1 { get; set; }
[Output("ind_Dead", Color = Colors.Blue, Thickness = 1)]
public IndicatorDataSeries ind_Dead { get; set; }
public IndicatorDataSeries Result;
private MacdCrossOver iMACD;
private BollingerBands iBands;
private double Trend1, Trend2, Explo1, Explo2, Dead;
protected override void Initialize()
{
Result = CreateDataSeries();
iMACD = Indicators.MacdCrossOver(26, 12, 9);
iBands = Indicators.BollingerBands(MarketSeries.Close, 20, 2, MovingAverageType.Simple);
}
public override void Calculate(int index)
{
Trend1 = (iMACD.MACD[index] - iMACD.MACD[index - 1]) * Sensetive;
Trend2 = (iMACD.MACD[index - 1] - iMACD.MACD[index - 2]) * Sensetive;
Explo1 = (iBands.Top[index] - iBands.Bottom[index]);
Explo2 = (iBands.Top[index - 1] - iBands.Bottom[index - 1]);
Dead = Symbol.PipSize * DeadZonePip / 10;
if (Trend1 >= 0 && iMACD.Histogram[index] > 0)
{
ind_Trend1[index] = Trend1;
ind_iTrend1[index] = 0;
}
if (Trend1 < 0 && iMACD.Histogram[index] < 0)
{
ind_iTrend1[index] = (-1 * Trend1);
ind_Trend1[index] = 0;
}
ind_Explo1[index] = Explo1;
ind_Dead[index] = Dead;
}
}
}
Waddah attar MT4 code below
//+------------------------------------------------------------------+
//| Waddah_Attar_Explosion.mq4 |
//| Copyright © 2006, Eng. Waddah Attar |
//| waddahattar@hotmail.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Eng. Waddah Attar"
#property link "waddahattar@hotmail.com"
//----
#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_color3 Sienna
#property indicator_color4 Blue
#property indicator_minimum 0.0
//----
extern int Sensetive = 150;
extern int DeadZonePip = 30;
extern int ExplosionPower = 15;
extern int TrendPower = 15;
extern bool AlertWindow = true;
extern int AlertCount = 500;
extern bool AlertLong = true;
extern bool AlertShort = true;
extern bool AlertExitLong = true;
extern bool AlertExitShort = true;
//----
double ind_buffer1[];
double ind_buffer2[];
double ind_buffer3[];
double ind_buffer4[];
//----
int LastTime1 = 1;
int LastTime2 = 1;
int LastTime3 = 1;
int LastTime4 = 1;
int Status = 0, PrevStatus = -1;
double bask, bbid;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{
SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 2);
SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 2);
SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 2);
SetIndexStyle(3, DRAW_LINE, STYLE_DOT, 1);
//----
SetIndexBuffer(0, ind_buffer1);
SetIndexBuffer(1, ind_buffer2);
SetIndexBuffer(2, ind_buffer3);
SetIndexBuffer(3, ind_buffer4);
//----
IndicatorShortName("Waddah Attar Explosion: [S(" + Sensetive +
") - DZ(" + DeadZonePip + ") - EP(" + ExplosionPower +
") - TP(" + TrendPower + ")]");
Comment("copyright waddahwttar@hotmail.com");
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
double Trend1, Trend2, Explo1, Explo2, Dead;
double pwrt, pwre;
int limit, i, counted_bars = IndicatorCounted();
//----
if(counted_bars < 0)
return(-1);
//----
if(counted_bars > 0)
counted_bars--;
limit = Bars - counted_bars;
//----
for(i = limit - 1; i >= 0; i--)
{
Trend1 = (iMACD(NULL, 0, 20, 40, 9, PRICE_CLOSE, MODE_MAIN, i) -
iMACD(NULL, 0, 20, 40, 9, PRICE_CLOSE, MODE_MAIN, i + 1))*Sensetive;
Trend2 = (iMACD(NULL, 0, 20, 40, 9, PRICE_CLOSE, MODE_MAIN, i + 2) -
iMACD(NULL, 0, 20, 40, 9, PRICE_CLOSE, MODE_MAIN, i + 3))*Sensetive;
Explo1 = (iBands(NULL, 0, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, i) -
iBands(NULL, 0, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, i));
Explo2 = (iBands(NULL, 0, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, i + 1) -
iBands(NULL, 0, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, i + 1));
Dead = Point * DeadZonePip;
ind_buffer1[i] = 0;
ind_buffer2[i] = 0;
ind_buffer3[i] = 0;
ind_buffer4[i] = 0;
if(Trend1 >= 0)
ind_buffer1[i] = Trend1;
if(Trend1 < 0)
ind_buffer2[i] = (-1*Trend1);
ind_buffer3[i] = Explo1;
ind_buffer4[i] = Dead;
if(i == 0)
{
if(Trend1 > 0 && Trend1 > Explo1 && Trend1 > Dead &&
Explo1 > Dead && Explo1 > Explo2 && Trend1 > Trend2 &&
LastTime1 < AlertCount && AlertLong == true && Ask != bask)
{
pwrt = 100*(Trend1 - Trend2) / Trend1;
pwre = 100*(Explo1 - Explo2) / Explo1;
bask = Ask;
if(pwre >= ExplosionPower && pwrt >= TrendPower)
{
if(AlertWindow == true)
{
Alert(LastTime1, "- ", Symbol(), " - BUY ", " (",
DoubleToStr(bask, Digits) , ") Trend PWR " ,
DoubleToStr(pwrt,0), " - Exp PWR ", DoubleToStr(pwre, 0));
}
else
{
Print(LastTime1, "- ", Symbol(), " - BUY ", " (",
DoubleToStr(bask, Digits), ") Trend PWR ",
DoubleToStr(pwrt, 0), " - Exp PWR ", DoubleToStr(pwre, 0));
}
LastTime1++;
}
Status = 1;
}
if(Trend1 < 0 && MathAbs(Trend1) > Explo1 && MathAbs(Trend1) > Dead &&
Explo1 > Dead && Explo1 > Explo2 && MathAbs(Trend1) > MathAbs(Trend2) &&
LastTime2 < AlertCount && AlertShort == true && Bid != bbid)
{
pwrt = 100*(MathAbs(Trend1) - MathAbs(Trend2)) / MathAbs(Trend1);
pwre = 100*(Explo1 - Explo2) / Explo1;
bbid = Bid;
if(pwre >= ExplosionPower && pwrt >= TrendPower)
{
if(AlertWindow == true)
{
Alert(LastTime2, "- ", Symbol(), " - SELL ", " (",
DoubleToStr(bbid, Digits), ") Trend PWR ",
DoubleToStr(pwrt,0), " - Exp PWR ", DoubleToStr(pwre, 0));
}
else
{
Print(LastTime2, "- ", Symbol(), " - SELL ", " (",
DoubleToStr(bbid, Digits), ") Trend PWR " ,
DoubleToStr(pwrt, 0), " - Exp PWR ", DoubleToStr(pwre, 0));
}
LastTime2++;
}
Status = 2;
}
if(Trend1 > 0 && Trend1 < Explo1 && Trend1 < Trend2 && Trend2 > Explo2 &&
Trend1 > Dead && Explo1 > Dead && LastTime3 <= AlertCount &&
AlertExitLong == true && Bid != bbid)
{
bbid = Bid;
if(AlertWindow == true)
{
Alert(LastTime3, "- ", Symbol(), " - Exit BUY ", " ",
DoubleToStr(bbid, Digits));
}
else
{
Print(LastTime3, "- ", Symbol(), " - Exit BUY ", " ",
DoubleToStr(bbid, Digits));
}
Status = 3;
LastTime3++;
}
if(Trend1 < 0 && MathAbs(Trend1) < Explo1 &&
MathAbs(Trend1) < MathAbs(Trend2) && MathAbs(Trend2) > Explo2 &&
Trend1 > Dead && Explo1 > Dead && LastTime4 <= AlertCount &&
AlertExitShort == true && Ask != bask)
{
bask = Ask;
if(AlertWindow == true)
{
Alert(LastTime4, "- ", Symbol(), " - Exit SELL ", " ",
DoubleToStr(bask, Digits));
}
else
{
Print(LastTime4, "- ", Symbol(), " - Exit SELL ", " ",
DoubleToStr(bask, Digits));
}
Status = 4;
LastTime4++;
}
PrevStatus = Status;
}
if(Status != PrevStatus)
{
LastTime1 = 1;
LastTime2 = 1;
LastTime3 = 1;
LastTime4 = 1;
}
}
return(0);
}
//+------------------------------------------------------------------+
@VHS10
VHS10
31 May 2020, 23:26
RE:
valter.f said:
Hello friends.
I'm new to Ctrader / forum and I need your help, please.
I need a bot that moves my stop loss (1 pip of profit / 1 pip of stop towards the trade) for swing trade operations.
I found bots in CAlgo that do that, but they do sales and purchases too. I need a bot just to move my stop loss. Can you help me?
Tks.
Valter.
Have you been able to get this done?
@VHS10
VHS10
31 May 2020, 23:07
Hi there,
In my quest to establish a trade copying system between MT4 and Ctrader, I installed MQL-ZMQ bindings and have my MT4 running as a server.
The last hurdle is having a working Cbot receiver that picks from the MT4 Server.
I will attach the MT4ServerZmq.Mq4 file which i hope will be of use in modifying the Cbot receiver sample code i also have attached.
The MT4serverZmq code:
#property copyright "Copyright 2020, Toki"
#property link "tobioluwatoki@gmail.com"
#property version "1.00"
#property strict
#property show_inputs
#include <Mql/Lang/Script.mqh>
#include <Mql/Format/Resp.mqh>
#include <Mql/Lang/Hash.mqh>
#include <Zmq/Zmq.mqh>
#include "CommandProcessor.mqh"
//+------------------------------------------------------------------+
//| A tcp client connection |
//+------------------------------------------------------------------+
class TcpClient
{
private:
uchar m_id[];
public:
TcpClient(ZmqMsg &msg)
{
PrintFormat(">>> Debug: client id is %d bytes",msg.size());
msg.getData(m_id);
}
bool equals(const TcpClient *client) const
{
return ArrayCompare(m_id, client.m_id) == 0;
}
int hash() const
{
return (int)MurmurHash3_x86_32(m_id,0x7e34a273);
}
};
//+------------------------------------------------------------------+
//| For using TcpClient in a HashMap |
//+------------------------------------------------------------------+
class TcpClientEqualityComparer: public EqualityComparer<TcpClient*>
{
public:
bool equals(const TcpClient *left,const TcpClient *right) const
{
return left.equals(right);
}
int hash(const TcpClient *value) const
{
return value.hash();
}
};
//+------------------------------------------------------------------+
//| Mt4ServerRaw Parameters |
//+------------------------------------------------------------------+
class Mt4ServerRawParam: public AppParam
{
ObjectAttr(string,listenAddresss,ListenAddress);
public:
bool check() {return true;}
};
//+------------------------------------------------------------------+
//| A ZMQ STREAM server that receives command from raw tcp clients |
//| and returns the results |
//| This server enables a user to use a standard Redis client (like |
//| the redis-cli) to send commands to a mt4 terminal instance |
//+------------------------------------------------------------------+
class Mt4ServerRaw: public Script
{
private:
string m_address;
Context m_context;
HashMap<TcpClient*,RespStreamParser*>m_clients;
Socket m_socket;
uchar m_commandBuffer[];
uchar m_replyBuffer[];
CommandProcessor *m_processor;
public:
Mt4ServerRaw(Mt4ServerRawParam *param)
:m_address(param.getListenAddress()),m_clients(new TcpClientEqualityComparer,true),m_socket(m_context,ZMQ_STREAM)
{
if(!m_socket.bind(m_address))
{
fail(StringFormat(">>> Error binding to %s: %s",m_address,Zmq::errorMessage(Zmq::errorNumber())));
return;
}
m_socket.setStreamNotify(true); // notify connect/disconnect
m_processor=new TradeCommandProcessor;
}
~Mt4ServerRaw() {delete m_processor;}
void main(void);
};
//+------------------------------------------------------------------+
//| A server that receives command from the client and returns the |
//| results |
//+------------------------------------------------------------------+
void Mt4ServerRaw::main()
{
// Initialize poll set
PollItem items[1];
m_socket.fillPollItem(items[0],ZMQ_POLLIN);
while(!IsStopped())
{
ZmqMsg id;
ZmqMsg request;
int ret=Socket::poll(items,500);
if(ret==-1)
{
Print(">>> Polling input failed: ",Zmq::errorMessage(Zmq::errorNumber()));
continue;
}
if(!items[0].hasInput()) continue;
if(!m_socket.recv(id))
{
Print(">>> Failed retrieve client id: ",Zmq::errorMessage(Zmq::errorNumber()));
continue;
}
TcpClient *client=new TcpClient(id);
RespStreamParser *parser=NULL;
if(!m_clients.contains(client))
{
Print(">>> New client from ",id.meta("Peer-Address"));
if(!m_socket.recv(request))
{
Print(">>> Failed receive connection: ",Zmq::errorMessage(Zmq::errorNumber()));
}
else
{
parser=new RespStreamParser;
m_clients.set(client,parser);
}
continue;
}
else
{
parser=m_clients[client];
if(!m_socket.recv(request))
{
Print(">>> Failed receive request: ",Zmq::errorMessage(Zmq::errorNumber()));
m_clients.remove(client);
SafeDelete(client);
continue;
}
else
{
//--- if the client closes the connection
if(request.size()==0)
{
m_clients.remove(client);
SafeDelete(client);
continue;
}
}
}
ArrayResize(m_commandBuffer,request.size(),100);
request.getData(m_commandBuffer);
parser.feed(m_commandBuffer);
RespValue *command=parser.parse();
RespValue *reply;
if(command==NULL)
{
if(parser.getError()!=RespParseErrorNeedMoreInput)
{
string error=EnumToString(parser.getError());
Print(">>> Error parsing command: ",error);
reply=new RespError(error);
}
else continue;
}
else if(command.getType()!=RespTypeArray)
{
Print(">>> Invalid command: ","Command is not a RespArray");
reply=new RespError("Command is not a RespArray");
}
else
{
RespArray *c=dynamic_cast<RespArray*>(command);
Print(">>> Received command: ",c.toString());
reply=m_processor.process(c);
}
ArrayResize(m_replyBuffer,0,100);
//--- the client is trying to disconnect from the server if the reply is NULL
ZmqMsg response(reply==NULL?0:reply.encode(m_replyBuffer,0));
if(reply!=NULL)
{
response.setData(m_replyBuffer);
}
else
{
m_clients.remove(client);
}
SafeDelete(command);
if(reply!=Nil) SafeDelete(reply);
SafeDelete(client);
if(!m_socket.sendMore(id) || !m_socket.send(response))
{
Alert(StringFormat(">>> Critical error: failed to send response to client!!! (%s)",
Zmq::errorMessage(Zmq::errorNumber())
));
}
}
}
BEGIN_INPUT(Mt4ServerRawParam)
INPUT(string,ListenAddress,"tcp://127.0.0.1:6666"); // Mt4 Server Listen Address
END_INPUT
DECLARE_SCRIPT(Mt4ServerRaw,true)
//+------------------------------------------------------------------+
Cbot receiver sample:
protected override void OnStart()
{
using (var context = new Context(1))
{
using (Socket requester = context.Socket(SocketType.ROUTER))
{
requester.Bind("tcp://*:5999");
System.Threading.Thread.Sleep(1000);
double high = consulta(context,requester,"USDJPY","High",100)
}
}
}
private double consulta(ZMQ.Socket requester, string Ativo, String Series, int periodo)
{
requester.SendMore(Ativo, Encoding.Unicode);
requester.SendMore(Series, Encoding.Unicode);
requester.Send(Convert.ToString(periodo), Encoding.Unicode);
requester.Recv();
string buffer = requester.Recv(Encoding.Unicode);
return Convert.ToDouble(buffer);
}
}
@VHS10
VHS10
28 May 2020, 09:40
RE: RE: MT4 to Ctrader Trade Copier using .csv to communicate
firemyst said:
Does it print out an exception?
If not, after you read the file in, print out a random line number (like 5) to the log and see if it prints anything.
this will at least confirm whether or not it's reading the file in.
I appreciate your response,
This is the error message that generates right before the bot crashes.
28/05/2020 06:33:44.134 | New cBot, EURUSD, m1 | Crashed in OnTick with NullReferenceException: Object reference not set to an instance of an object.
This error comes after the log prints out number one (1). so that confirms it's reading the file in
@VHS10
VHS10
26 May 2020, 09:14
RE:
PanagiotisCharalampous said:
Hi tobioluwatoki,
There was one build error which I fixed in the code below
using System; using System.Collections.Generic; using System.IO; 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.FullAccess)] //AccessRights.FullAccess public class MT2cTrader : Robot { [Parameter("Orders Input File Path", DefaultValue = "C:\\Users\\trader\\AppData\\Roaming\\MetaQuotes\\Terminal\\69420FB8433504FEA0FA029C390238DB\\MQL4\\Files\\TradeCopy.csv")] // C:\\Users\\trader\\CSV\\TradeCopy.csv public string orders_input_file { get; set; } [Parameter("Slippage", DefaultValue = 3.5)] public double slippage { get; set; } [Parameter("Delimiter", DefaultValue = ";")] public string delimiter { get; set; } protected override void OnStart() { } private bool debug = true; protected override void OnTick() { //todo, check M.D. //price = marketDepth.AskEntries[0].Price; //volume = marketDepth.AskEntries[0].Volume; string[] lines = new String[0]; try { lines = File.ReadAllLines(orders_input_file); } catch (Exception e) { Print("Exception: " + e.Message); return; } List<string> existing_positions = new List<string>(); foreach (string line in lines) { OrderData order = new OrderData(line.Split(delimiter.Length > 0 ? delimiter[0] : ','), MarketData); existing_positions.Add(order.label); if (debug) Print(line); if (order.isCorrect() && (Positions.Find(order.label) == null)) ExecuteMarketOrder(order.type, order.symbol, order.lot, order.label, order.sl, order.tp, slippage); } for (int pos = 0; pos < Positions.Count; pos++) if (!existing_positions.Contains(Positions[pos].Label)) ClosePosition(Positions[pos]); } } public class OrderData { private const long mt_lot_coefficient = 100000; //corrected_100000_july1 public Symbol symbol; public TradeType type; public long lot; public int sl; public int tp; public string label; private bool initialized_properly = true; public OrderData(string[] raw_pieces, MarketData market_data) { try { this.label = raw_pieces[0].Trim(); this.symbol = market_data.GetSymbol(raw_pieces[1].Trim()); this.setType(Convert.ToInt32(raw_pieces[2].Trim())); this.lot = Convert.ToInt64(this.parseDouble(raw_pieces[3]) * mt_lot_coefficient); double price = this.parseDouble(raw_pieces[4]); this.sl = this.getPipDistance(price, this.parseDouble(raw_pieces[5])); this.tp = this.getPipDistance(price, this.parseDouble(raw_pieces[6])); } catch (Exception e) { return; } { this.initialized_properly = false; } } public bool isCorrect() { return this.initialized_properly; } private double parseDouble(string value) { return double.Parse(value.Trim().Replace(',', '.'), System.Globalization.CultureInfo.InvariantCulture); } private void setType(int mt_type) { this.type = mt_type == 0 ? TradeType.Buy : TradeType.Sell; } private int getPipDistance(double basic_price, double close_price) { return Convert.ToInt32(Math.Round(Math.Abs(basic_price - close_price) / this.symbol.PipSize)); } } }
Best Regards,
Panagiotis
Panagiotis, You are very kind indeed.
Bless you.
@VHS10
VHS10
22 Aug 2020, 17:43 ( Updated at: 21 Dec 2023, 09:22 )
Hi Everyone.
Pardon me and let me use this platform for exposure.
I am Iman, a trader with over 7 years of experience and what i have to present to you is my Strategy, Tamarisk group. This strategy Uses volumetric analysis to determine trades and the accuracy currently sits at 88%. Drawdown has stayed under 10% on the average and trades are never open for too long. Projected minimum Return on Investment is around 50% per month.
You may review the strategy page here (Use a computer to view the link)
You may join the strategy's group chat to let current copiers share their experience with you https://t.me/TamariskGroup
@VHS10