I am running some tests with the "Print" function and the "RecalcLastBarAfter()" function, and I need some clarification.
I am running on a chart a Signal with this simple code:
Code: Select all
[IntrabarOrderGeneration = True];
Var: intrabarpersist TickCounter(0);
Var: intrabarpersist BarCounter(0);
RecalcLastBarAfter(1);
If LastBarOnChart then begin
TickCounter=TickCounter+1;
If barstatus(1)=0 then BarCounter=0;
BarCounter=BarCounter+1;
Print(File("C:\Users\Utente07\Documents\test.txt"),
Time_S:0:0,
" BarStatus: ",barstatus(1):0:0,
" BarNumber: ",BarNumber:0:0,
" TickCounter ",TickCounter:0:0,
" BarTickCounter ",BarCounter:0:0,
" Ask: ",CurrentAsk:0:0,
" Bid: ",CurrentBid:0:0,
" Last: ",last:0:0,
" Close: ",Close:0:0
);
end;
My goal was to find out if Multicharts was reading the bid and ask price correctly at the broker (WeBank).
The result of the test was positive, but I realized that while the bid and ask prices were constantly changing at the broker, in the Multicharts signal they were updated only when a tick arrived that allowed the recalculation of the formula.
And this is correct as far as I understood how Multicharts works.
So to try to get an update of the bid and ask also in the signal I thought to use the RecalcLastBarAfter function once per second, and I would like an explanation of the observed behavior:
Correctly every second the line of the print function is reprinted, but it seems that Time_s is not recalculated correctly.
In each line the time should have one second more.
Why doesn't this happen?
Why for several lines the time remains the same and is printed updated only after a few lines,
when probably a tick comes in and causes the signal recalculation?
And as a result, with every line printed for recalc, just as no time_s is updated, probably no bid and ask are updated either,
defeating the purpose of the recalc function of the signal?
Best regards
Massimo