Signal does not work in IOG  [SOLVED]

Questions about MultiCharts and user contributed studies.
maxmax68
Posts: 163
Joined: 20 Nov 2012
Has thanked: 55 times
Been thanked: 48 times

Signal does not work in IOG

Postby maxmax68 » 20 Jan 2014

Hi All,
I hope you can help me to understand why this signal does not work in IOG.
If I apply to the chart in non IOG mode it draws the text box and the trend line.
On the contrary, if I turn to the IOG mode it does not work. No text, no line.
I can' t understand why. I declared all variables as recalcpersist.
Plase, any support would be greatly appreciated.
Regards
Massimo

Code: Select all

[ProcessMouseEvents = True];
//[IntrabarOrderGeneration = True];

Inputs:
vQuantita(1), // Input Quantita' titoli da scambiare
vTL(0), // Input prezzo della Trigger Line
vTick(5); // Valore Tick
Vars:
recalcpersist vValue1(0), // id bottone n1
recalcpersist vValueTL(0), // id TriggerLine
recalcpersist vMostLeftDateTime(0),
recalcpersist vMostRightDateTime(0),
recalcpersist vHighestDispValue(0),
recalcpersist vLowestDispValue(0),
recalcpersist vMinMove(0), // Movimento minimo scala prezzi
recalcpersist vX(0), // coordinata x bottoni
recalcpersist vY(0), // coordinata y punto inferiore (click mouse)
recalcpersist vXOffset(0.1), // Offset % x rispetto angolo basso sx
recalcpersist vYOffset(0.2), // Offset % y rispetto angolo basso sx
recalcpersist vY1(0), // coordinata y bottone 1
recalcpersist vCounter1(0), // counter associato bottone 1
recalcpersist vQTy(0), // Quantita' titoli da scambiare
recalcpersist vTriggerLine(0), // Valore prezzo della Trigger Line
recalcpersist vMP(0); // Attuale MarketPosition at Broker 0=Flat 1=Long -1=Short
//
// Calcola quantita' titoli da scambiare
//
if MarketPosition_at_Broker = 0 then begin
vQTy = vQuantita;
vMP = 0;
end else if MarketPosition_at_Broker > 0 then begin
vQTy = MarketPosition_at_Broker;
vMP = 1;
end else if MarketPosition_at_Broker < 0 then begin
vQTy = -1*MarketPosition_at_Broker;
vMP = -1;
end;
//
// Calcola prezzo della Trigger Line
//
once vTriggerLine=0;
if vTL <> 0 and vTriggerLine=0 then vTriggerLine = vTL
else if vTL=0 then begin
if Date <> Date[1] then vTriggerLine = Open;
end;
// Disegna la TriggerLine
once vValueTL = tl_new(Date, Time[1], vTriggerLine, Date, Time, vTriggerLine);
if TL_Exist(vValueTL)=false then tl_new(Date, Time[1], vTriggerLine, Date, Time, vTriggerLine);
once TL_SetExtLeft(vValueTL,True);
once TL_SetExtRight(vValueTL,True);
once TL_Lock(vValueTL,True);
tl_setbegin(vValueTL,Date,Time[1], vTriggerLine);
tl_setend(vValueTL,Date,Time, vTriggerLine);
//
// Determina DateTime piu' a destra e piu' a sinistra
// e prezzo piu' alto e piu' basso mostrati nella chart.
//
vMostLeftDateTime = GetAppInfo(aiLeftDispDateTime);
vMostRightDateTime = GetAppInfo(aiRightDispDateTime);
vHighestDispValue = GetAppInfo(aiHighestDispValue);
vLowestDispValue = GetAppInfo(aiLowestDispValue);
vMinMove = (vHighestDispValue-vLowestDispValue)/100;
//
// Inizializza i valori di partenza di vX e vY
// e calcola i valori di ordinata vYn dei vari bottoni
//
if vX=0 then vX = vMostLeftDateTime + vXOffset;
if vY=0 then vY = vLowestDispValue + (vHighestDispValue-vLowestDispValue) * vYOffset;
vY1= vY+20 * vMinMove;
//
// Disegna per la prima volta i bottoni sulla chart
//
once begin
vValue1=Text_New_Dt(vX, vY1,"");
end; // once
//
// Se MouseClickShiftPressed ...
//
if MouseClickShiftPressed then begin
//
// se click su chart, nessun bottone attivato
//
if mc_text_getactive=-1 then begin
// calcola nuovi offset per x e y coordinate bottoni
vXOffset = (MouseClickDateTime - vMostLeftDateTime) / (vMostRightDateTime - vMostLeftDateTime);
vYOffset = (MouseClickPrice - vLowestDispValue) / (vHighestDispValue-vLowestDispValue);
end
// Checks for MouseClick on TextBoxes and updates vCounters
else if MC_Text_GetActive=vValue1 then begin
vCounter1=vCounter1+1;
if vCounter1>1 then vCounter1=0;
end;
end; // Fine if MouseClickShiftPressed
//
// Calcola nuove coordinate X e Y bottoni
//
vX = vMostLeftDateTime + (vMostRightDateTime - vMostLeftDateTime) * vXOffset;
vY = vLowestDispValue + (vHighestDispValue-vLowestDispValue) * vYOffset;
vY1= vY+20 * vMinMove;
//
// Formatta e Ridisegna Bottoni ad ogni recalc
//
text_setborder(vValue1,TRUE);
text_setColor(vValue1,blue);
if vCounter1=0 then text_setBGColor(vValue1,lightgray)
else if vCounter1=1 then text_setBGColor(vValue1,cyan);
if vCounter1=0 then begin
if vMP=0 then text_setstring(vValue1,"PAUSED: MP FLAT "+NumToStr(MarketPosition_at_Broker,0))
else if vMP=1 then text_setstring(vValue1,"PAUSED: MP LONG "+NumToStr(MarketPosition_at_Broker,0))
else if vMP=-1 then text_setstring(vValue1,"PAUSED: MP SHORT "+NumToStr(MarketPosition_at_Broker,0));
end else if vCounter1=1 then begin
if vMP=0 then text_setstring(vValue1,"ACTIVE: MP FLAT "+NumToStr(MarketPosition_at_Broker,0))
else if vMP=1 then text_setstring(vValue1,"ACTIVE: MP LONG "+NumToStr(MarketPosition_at_Broker,0))
else if vMP=-1 then text_setstring(vValue1,"ACTIVE: MP SHORT "+NumToStr(MarketPosition_at_Broker,0));
end;
text_SetStyle(vValue1,0,1);
text_lock(vValue1,TRUE);
Text_SetLocation_DT(vValue1,vX,vY1);

User avatar
Smoky
Posts: 507
Joined: 03 Dec 2010
Location: Thailand
Has thanked: 97 times
Been thanked: 115 times

Re: Signal does not work in IOG

Postby Smoky » 20 Jan 2014

Rather vars: intrabarpersist ;)

maxmax68
Posts: 163
Joined: 20 Nov 2012
Has thanked: 55 times
Been thanked: 48 times

Re: Signal does not work in IOG

Postby maxmax68 » 20 Jan 2014

Hi Smoky,
thank you for your help.
I tried with intrabarpersist, but unfortunately it does not work.
Still searching for the error .
Any other idea ???
Regards
Massimo

Code: Select all


[ProcessMouseEvents = True];
//[IntrabarOrderGeneration = True];

Inputs:
vQuantita(1), // Input Quantita' titoli da scambiare
vTL(0), // Input prezzo della Trigger Line
vTick(5); // Valore Tick
Vars:
intrabarpersist vValue1(0), // id bottone n1
intrabarpersist vValueTL(0), // id TriggerLine
intrabarpersist vMostLeftDateTime(0),
intrabarpersist vMostRightDateTime(0),
intrabarpersist vHighestDispValue(0),
intrabarpersist vLowestDispValue(0),
intrabarpersist vMinMove(0), // Movimento minimo scala prezzi
intrabarpersist vX(0), // coordinata x bottoni
intrabarpersist vY(0), // coordinata y punto inferiore (click mouse)
intrabarpersist vXOffset(0.1), // Offset % x rispetto angolo basso sx
intrabarpersist vYOffset(0.2), // Offset % y rispetto angolo basso sx
intrabarpersist vY1(0), // coordinata y bottone 1
intrabarpersist vCounter1(0), // counter associato bottone 1
intrabarpersist vQTy(0), // Quantita' titoli da scambiare
intrabarpersist vTriggerLine(0), // Valore prezzo della Trigger Line
intrabarpersist vMP(0); // Attuale MarketPosition at Broker 0=Flat 1=Long -1=Short
//
// Calcola quantita' titoli da scambiare
//
if MarketPosition_at_Broker = 0 then begin
vQTy = vQuantita;
vMP = 0;
end else if MarketPosition_at_Broker > 0 then begin
vQTy = MarketPosition_at_Broker;
vMP = 1;
end else if MarketPosition_at_Broker < 0 then begin
vQTy = -1*MarketPosition_at_Broker;
vMP = -1;
end;
//
// Calcola prezzo della Trigger Line
//
once vTriggerLine=0;
if vTL <> 0 and vTriggerLine=0 then vTriggerLine = vTL
else if vTL=0 then begin
if Date <> Date[1] then vTriggerLine = Open;
end;
// Disegna la TriggerLine
once vValueTL = tl_new(Date, Time[1], vTriggerLine, Date, Time, vTriggerLine);
if TL_Exist(vValueTL)=false then tl_new(Date, Time[1], vTriggerLine, Date, Time, vTriggerLine);
once TL_SetExtLeft(vValueTL,True);
once TL_SetExtRight(vValueTL,True);
once TL_Lock(vValueTL,True);
tl_setbegin(vValueTL,Date,Time[1], vTriggerLine);
tl_setend(vValueTL,Date,Time, vTriggerLine);
//
// Determina DateTime piu' a destra e piu' a sinistra
// e prezzo piu' alto e piu' basso mostrati nella chart.
//
vMostLeftDateTime = GetAppInfo(aiLeftDispDateTime);
vMostRightDateTime = GetAppInfo(aiRightDispDateTime);
vHighestDispValue = GetAppInfo(aiHighestDispValue);
vLowestDispValue = GetAppInfo(aiLowestDispValue);
vMinMove = (vHighestDispValue-vLowestDispValue)/100;
//
// Inizializza i valori di partenza di vX e vY
// e calcola i valori di ordinata vYn dei vari bottoni
//
if vX=0 then vX = vMostLeftDateTime + vXOffset;
if vY=0 then vY = vLowestDispValue + (vHighestDispValue-vLowestDispValue) * vYOffset;
vY1= vY+20 * vMinMove;
//
// Disegna per la prima volta i bottoni sulla chart
//
once begin
vValue1=Text_New_Dt(vX, vY1,"");
end; // once
//
// Se MouseClickShiftPressed ...
//
if MouseClickShiftPressed then begin
//
// se click su chart, nessun bottone attivato
//
if mc_text_getactive=-1 then begin
// calcola nuovi offset per x e y coordinate bottoni
vXOffset = (MouseClickDateTime - vMostLeftDateTime) / (vMostRightDateTime - vMostLeftDateTime);
vYOffset = (MouseClickPrice - vLowestDispValue) / (vHighestDispValue-vLowestDispValue);
end
// Checks for MouseClick on TextBoxes and updates vCounters
else if MC_Text_GetActive=vValue1 then begin
vCounter1=vCounter1+1;
if vCounter1>1 then vCounter1=0;
end;
end; // Fine if MouseClickShiftPressed
//
// Calcola nuove coordinate X e Y bottoni
//
vX = vMostLeftDateTime + (vMostRightDateTime - vMostLeftDateTime) * vXOffset;
vY = vLowestDispValue + (vHighestDispValue-vLowestDispValue) * vYOffset;
vY1= vY+20 * vMinMove;
//
// Formatta e Ridisegna Bottoni ad ogni recalc
//
text_setborder(vValue1,TRUE);
text_setColor(vValue1,blue);
if vCounter1=0 then text_setBGColor(vValue1,lightgray)
else if vCounter1=1 then text_setBGColor(vValue1,cyan);
if vCounter1=0 then begin
if vMP=0 then text_setstring(vValue1,"PAUSED: MP FLAT "+NumToStr(MarketPosition_at_Broker,0))
else if vMP=1 then text_setstring(vValue1,"PAUSED: MP LONG "+NumToStr(MarketPosition_at_Broker,0))
else if vMP=-1 then text_setstring(vValue1,"PAUSED: MP SHORT "+NumToStr(MarketPosition_at_Broker,0));
end else if vCounter1=1 then begin
if vMP=0 then text_setstring(vValue1,"ACTIVE: MP FLAT "+NumToStr(MarketPosition_at_Broker,0))
else if vMP=1 then text_setstring(vValue1,"ACTIVE: MP LONG "+NumToStr(MarketPosition_at_Broker,0))
else if vMP=-1 then text_setstring(vValue1,"ACTIVE: MP SHORT "+NumToStr(MarketPosition_at_Broker,0));
end;
text_SetStyle(vValue1,0,1);
text_lock(vValue1,TRUE);
Text_SetLocation_DT(vValue1,vX,vY1);

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: Signal does not work in IOG

Postby Andrew MultiCharts » 22 Jan 2014

Please read this article attentively.

maxmax68
Posts: 163
Joined: 20 Nov 2012
Has thanked: 55 times
Been thanked: 48 times

Re: Signal does not work in IOG  [SOLVED]

Postby maxmax68 » 22 Jan 2014

Thank you Andrew for your suggestion, but unfortunately it was not resolutive.
Probably the solution of the problem is in a command discussed in another topic:

viewtopic.php?f=1&t=45969

Adding
[RecoverDrawings = False]
it seems to be ok !!!

To know something more about this command I opened a new topic and asked for Support Team help.
RecoverDrawings seems to be a well covered top secret .
Regards
Massimo

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: Signal does not work in IOG

Postby Andrew MultiCharts » 23 Jan 2014

The attribute is described now on Wiki page.


Return to “MultiCharts”