Madrid
Posts: 7 since Jan 2018
Thanks Given: 0
Thanks Received: 0
|
Hello, my name is Maikel, my level of Multicharts.Net is not yet very high,
I have the following problem that I have been trying to solve for weeks.
The only objective of the signal algorithm that I intend to do is to open orders at the exact time instant that a TimeTime List indicates, perhaps someone will find a better and easier way.
I think it's very interesting because what I want to do is to send orders that are previously written in a Global Static List,
in the script that I attach the orders are directly written from the script itself, but in the future I want to do it from an
indicator, I think it will be very useful in order to opening operations from an indicator, sending it before to a signal script.
The script is already working, almost properly, the only problem it has if that the operations are opened a candle before the right candle. I do not know why. In the script I draw an arrow object with the same logic that the ordersm and those arrows do are right positioned in the right candle.
Resuming, What I am doing is basically this (the full script is attached):
---------------------------------------------------------------------------------------------------------------------------------------
//Here I put the Date Time instant orders in Globals.OrdList List
Globals.OrdList.Add(new Orden()
{
DatTim = Convert.ToDateTime("19/01/2018 11:10:00"),
LargCort = "Long"
});
//Here I copy the orders from Globals.OrdList List to OrdImport List
while ((p < Globals.OrdList.Count) & (Globals.OrdList.Count > 0))
{
OrdImport.Add(new OrdenImp()
{
DatTim = Globals.OrdList[p].DatTim,
LargCort = Globals.OrdList[p].LargCort
});
p = p + 1;
}
if (StrategyInfo.MarketPosition == 0) //IF WE DO NOT HAVE ANY OPERATION OPENED (IT IS ALWAYS CERO, I DO NOT KNOW WHY)
{
if (LargCortAux == "Long")
{
Output.WriteLine("Long en Bars.CurrentBar: {0} - DateTime: {1} - Price: {2:.00}",Bars.CurrentBar,BarsOfData(1).Time[0],BarsOfData(1).Close[0]);
BuyOrder.Send();
LargCortAux = "nothing";
//-DRAW ARROW ------------------------
IArrowObject arrowData1 = DrwArrow.Create(
new ChartPoint(Bars.CurrentBar + 1, BarsOfData(2).Close[0]), false);
arrowData1.Size = 25;
//----------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
I use 15m timeframe for the main chart, and 1tick data sub chart (hiden).
It is necesary to add Globals. And compile all (ctrl +F7).
The result of one example operation is in an image attached.
As I said at the beginning, the only objective of the signal algorithm that I intend to do is to open orders at the exact time instant that a TimeTime List indicates, maybe someone will get a better and easier way.
WSSignal.wsp
Globals.cs
Signal.cs
|