[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re:EL Question about Real Time



PureBytes Links

Trading Reference Links


I think you want to explore

LastCalcDate and LastCalcTime, and the other "Last" functions.

These are both true only for the last bar of a chart. For real-time charts this means the most recent real-time bar.

For historical charts, it picks out the very last bar on the chart. You can use this behaviour to switch between real-time or historical behaviour.

Historical: if D <> LastCalcDate or T <> LastCalcTime then...

Real-time: if D = LastCalcDate and T = LastCalcTime then ...

HTH

Mike G

>Thanks for your answer. Let me try to rephrase my question. Actually it is a
>difficult thing to explain.
>
>I need to know while my strategy is running, if the data I am dealing with
>is the historical data that comes into the strategy when the strategy first
>starts or IF on the other hand I am actually seeing the tick by tick real
>time data.
>
>Is the High, Low, Close value I am reading, is it a history bar or the
>current real time bar?
>
>Actual execution of trades should only happen in real time. My DLL
>interfaces to the Globex computer and I want to place trades ONLY when I
>know my strategy is getting the latest quotes. This will prevent executing
>trades based on the initial historical data coming into the strategy when
>the strategy starts up.
>
>I need some type of EL command that would say for example that "This Data is
>Fresh". If I had a "DataIsNowFresh" property that would be great. As it is I
>can do it like I coded in my example below:
>
>---------------------
>Vars: DataIsFresh(0), LastTime(0), RetVal(0);
>
>DefineDLLFunction: "MyOrder.DLL", Long, "PlaceOrder", LPSTR, Long;
>
>If (DataIsFresh = 0) and (Date >= CurrentDate) and (Time >= CurrentTime)
>Then
>   LastTime = Time;
>
>If (LastTime > 0) and (Time > LastTime) Then
>   DataIsFresh = 1;
>
>{WHEN MY STRATEGY SIGNALS TO BUY I CAN NOW USE THIS STATEMENT}
>If DataIsFresh Then RetVal = PlaceOrder("BUY MARKET ESM2", 5);
>----------------------
>
>This actually prevents me from placing dozens of unwanted orders too early
>in history.
>
>Thanks for your input,
>
>Mike.