Signal not stopped when turned off

Questions about MultiCharts and user contributed studies.
arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Signal not stopped when turned off

Postby arjfca » 09 Aug 2011

Hello

I have a strange event that occur on my signal code. The process is continuing after being stopped in the Signal Format Status

A signal is use to send bars info to Excel using special function from XLInput. All work fine, exept, when I turn off my signal, I should expect the the code to stop sending info to Excel, but it continu

Code: Select all

("B27"),
iActualQtyLong("B28"),
ientrypriceLong ("B29"),
iActualLongStop ("B30"),
iActualQtyShort("B31"),
iEntryPriceShort ("B32"),
iActualShortStop ("B33"),
ilastSH ("B37"),
iLastSL ("B38"),

iValueRead ("B47");

Vars: oPivotPrice(0), oPivotBar(0);
Var:
sValue(""),
comma (","),
Condition0 (False),
IntraBarPersist MarketPos_Val (""),
Intrabarpersist ientryPrice (0),
IntraBarPersist OpenDataSent (False),
Intrabarpersist StringFromExcel ("Init"),
IntraBarpersist ExStringFromExcel (""),
Intrabarpersist Highbar (0),
Intrabarpersist LowBar (0),
IntrabarPersist LastClose (0),
IntraBarPersist OrderString ("");
//----------------------------------------------------------------------------------------------
// Code Start here
If lastbaronChart then begin
//Initialisation. Process to be executed once only
Once If barnumber = 1 then begin
// Init the first delay time counter
Targettime = referenceTime + delay;

//Look for the Excel Sheet to be open To be coded
// If not opened, launch it
scale = scaleString;
NameInstrument = GetSymbolName;
InitString = NameInstrument + comma + Scale;
Condition0 = XLO.TextA1(sBook,sSheet,iInitString,InitString); // Capture the scale
//Condition0 = XLO.TextA1(sBook,sSheet,GetSymbolName,iInstrument); // Capture the instrument Name

Targettime = Machinetime + delay;
referenceTime = machineTime; // Saving a reference of the time

end; //If barnumber = 1 then begin

If barstatus[1] = 2 then begin
LSL1 = PivotLowVS(1, Low, 1, 1, 21);
LSL2 = PivotLowVS(2, Low, 1, 1, 21);
LSH1 = PivotHighVS(1, High, 1, 1, 21);
LSH2 = PivotHighVS(2, High, 1, 1, 21);

// Last completed bar terminaison time capture and formating
LastBarTime = LastCalcTime;
LastBarTimeString = NumtoStr(LastCalcTime,0);
//Format the value to make sure that the variable as 4 digits
If Strlen(LastBarTimeString) < 4 then LastBarTimeString = "0" + LastBarTimeString;
LastBarTimeString = LeftStr(LastBarTimeString,2) + ":" + RightStr(LastBarTimeString,2);
end;

// Reading data from Excel

OrderString = GVGetNamedString("OrderToSend","Error");
IF OrderString <> "" then Begin
Print(OrderString);
Value1= GVSetNamedString ("OrderToSend",""); // The string as been read, then Reset the orderstring value.
end;

Switch (i_MarketPosition) begin
Case= 1:
MarketPos_Val = "Long";
Case = -1:
MarketPos_Val = "Short";
Case = 0:
MarketPos_Val = "-";
end;

DataString = Numtostr(Open,5) + comma + NumtoStr(High,5) + comma + NumtoStr(Low,5) + comma + NumToStr(Close,5) + comma +
Numtostr(Open[1],5) + comma + NumtoStr(High[1],5) + comma + NumtoStr(Low[1],5) + comma + NumToStr(Close[1],5) ; //String 1 to 8

Datastring2 = NumtoStr(LSL1,5) + comma + NumToStr(LSL2,5) + comma + NumToStr(LSH1,5) + comma + NumToStr(LSH2,5); //String 9 to 12

Datastring3 = lastBarTimeString + comma + MarketPos_Val + comma + NumToStr(i_CurrentShares,0) + comma + NumtoStr(I_AvgEntryPrice,4) ; //string 13 to 16

Datastring4 = Numtostr(NetProfit,0); //string 17

DataString = DataString + comma + DataString2 + comma + Datastring3 + comma + datastring4;

If Machinetime > referencetime then begin // Delay is over
Referencetime = Machinetime + delay;
//if lastbaronchart then print (datastring);
XLO.TextA1(sBook,sSheet,iDataString,DataString);
end; //If Machinetime > referencetime

// Now, decode the data

end; //If lastbaronChart then begin
Is it only the trade signal that is stopped? The way I see it is the code is still running after being stopped by the "OFF" status.

Martin

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Re: Signal not stopped when turned off

Postby Dave Masalov » 10 Aug 2011

Martin,

I believe this has been resoled in the Live Chat. Please let us know if you have any further questions.

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Re: Signal not stopped when turned off

Postby arjfca » 10 Aug 2011

Yes, problem is resolved.

My signal code was applied to 2' hidden chart. When i was stopping my signal, I was only stopping it on the first charts. I had installed this hidden charts few time ago and i had forgot it.

Great services from you guy's

Martin


Return to “MultiCharts”