NexusFi: Find Your Edge


Home Menu

 





MultiCharts lag time?


Discussion in MultiCharts

Updated
      Top Posters
    1. looks_one bobbakerr with 63 posts (24 thanks)
    2. looks_two Big Mike with 19 posts (19 thanks)
    3. looks_3 Jura with 11 posts (8 thanks)
    4. looks_4 Bimi with 10 posts (7 thanks)
      Best Posters
    1. looks_one bretter with 4 thanks per post
    2. looks_two RM99 with 2.3 thanks per post
    3. looks_3 Big Mike with 1 thanks per post
    4. looks_4 bobbakerr with 0.4 thanks per post
    1. trending_up 57,176 views
    2. thumb_up 144 thanks given
    3. group 23 followers
    1. forum 171 posts
    2. attach_file 2 attachments




 
Search this Thread

MultiCharts lag time?

  #81 (permalink)
 
bobbakerr's Avatar
 bobbakerr 
Riverdale, Idaho, USA
 
Experience: Intermediate
Platform: Optimus Futures + MultiCharts + TradeStation
Broker: Optimus Futures, Rithmic Data, TradeStation
Trading: CL, ES
Posts: 115 since Aug 2010
Thanks Given: 241
Thanks Received: 51


MultiCharts View Post
I'll try to analyze this topic over the weekend and respond appropriately. Things have been very busy around here.

Thank you MUCH! MultiCharts has a brilliant platform and I want to keep using it if I can get it to work properly for the code I've written. I believe there is much promise here, both with MC and with my program. But so far ...

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
Trade idea based off three indicators.
Traders Hideout
How to apply profiles
Traders Hideout
MC PL editor upgrade
MultiCharts
REcommedations for programming help
Sierra Chart
 
  #82 (permalink)
 JackR 
Washington, DC
 
Experience: Intermediate
Platform: Multicharts
Broker: InteractiveBrokers/IB
Trading: CL\EUR
Posts: 15 since Jan 2011
Thanks Given: 10
Thanks Received: 8


bobbakerr View Post
I guess I'm having a difficult time making myself clear on this. I can't seem to put it in a more understandable way (yet). Maybe tomorrow I'll be able to. I'm off to bed.

Bob:
OK. I now understand your frustration. Perhaps once MC gets 7.0 released they will have more time to devote to your problem.

Jack

Reply With Quote
  #83 (permalink)
 bomberone1 
London
 
Experience: Beginner
Platform: MultiCharts
Posts: 277 since Nov 2010
Thanks Given: 14
Thanks Received: 29


Folks my 2 cents, in weeken I have more time to respond to your enquery.
I compare multicharts to major proprietary backtesting software on wich we made consultant.

The main lack before i write on data1=bid , data2=ask, to split the code etccc.... is that

FIrst
The database how to collect tick data multicharts in inappropriate, because
database doen't have tick id sequence of bid , ask trade.
Now, first of all reade all these 3 posts
IQFeed and [AUTOLINK]MultiCharts[/AUTOLINK] Cumulative [AUTOLINK]Delta[/AUTOLINK] Update [AUTOLINK]MultiCharts[/AUTOLINK] Blog
MultiCharts Project Management - Issue MC-156 - Ticks Sequencing ID
MultiCharts: Trading Software for Automated Trading and [AUTOLINK]Backtesting[/AUTOLINK] • View topic - [AUTOLINK]Cumulative Delta[/AUTOLINK] & Volume Delta

When in mc there will be the id tick capability we are at a good step to have a more realistick backtesting results.

Second point all data in the database chould be upload, in this case i see that only iqfeed is right for this purpose, the proble in that only 180 tick day are avaible, so we need to ask at iqfeed to give us more historical tickdata. These will be difficxult now but that will be normal in the next years have 10 years of historical data collected by id protocol.

Third point
Change the way how built strategy in your code the easiest point
buy at close of data2
sell shor at close of data1
so in backtest propriety chise data1 ask, data2=bid.
using stp and limit order to have less slippage or book pressure.

It's a really good idea to built a database from iqfeed or other feed like zenfire where collect data and start to share.
People that check the quality of data. Remember that at institutional trading form any engeneer all day works on myswl or sql database to check the integrity of data. Good data it's really important if you don't want have surprise from backtesting to real.

My best

Reply With Quote
Thanked by:
  #84 (permalink)
 JackR 
Washington, DC
 
Experience: Intermediate
Platform: Multicharts
Broker: InteractiveBrokers/IB
Trading: CL\EUR
Posts: 15 since Jan 2011
Thanks Given: 10
Thanks Received: 8


bomberone1 View Post
...When in MC there will be the id tick capability we are at a good step to have a more realistick backtesting results....

It appears that TickID will be added to MC 7. They say "TickID – events (ticks) are processed by MultiCharts upon their arrival are now sequence-stamped with a unique number, which allows MultiCharts to track ticks in the exact order they arrived."
See here for details: MULTICHARTS 7 [AUTOLINK]BETA[/AUTOLINK] 1 RELEASE [AUTOLINK]MultiCharts[/AUTOLINK] Blog

But it only works for real-time data, not back-fill data. See above link. However, it may be a step towards solving Bob's problem.

Jack

Reply With Quote
Thanked by:
  #85 (permalink)
 bomberone1 
London
 
Experience: Beginner
Platform: MultiCharts
Posts: 277 since Nov 2010
Thanks Given: 14
Thanks Received: 29


JackR View Post
See here for details: MULTICHARTS 7 [AUTOLINK]BETA[/AUTOLINK] 1 RELEASE [AUTOLINK]MultiCharts[/AUTOLINK] Blog
But it only works for real-time data, not back-fill data. See above link. However, it may be a step towards solving Bob's problem.
Jack

Reag again my post please, without back-fill or database costruction, no way to have realistick backtesting.

Another point to implement is the order generating.....it's really slow...
.
The point is that the engine order generating accumulate too many orders.
It's seems FIFO type mode for execution, but I don't know. In this it's easy built a long queue of order...

My Best

Reply With Quote
  #86 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690


bobbakerr View Post
OK, Jura. Your post convinced me to post the basics of my code. I'll change a few things, but keep the logic the same. It's really very simple. It has 2 data series (and 2 graphs). Both graphs use 2-cent range bars. (It also works well with 40-second bars and 12-Tick bars [for CL here] The upper graph is the current month contract of CL or ES. The lower graph is a contract that is farther out. The signals are derived from the lower graph and all trading is done off of the upper graph, where the Bid/Ask spread is minimal.

I've gone through 2 expiration dates with this program. I change the contracts a set number of days before the actual expiration day. MultiCharts is also set for Bar Magnifier On with 1 Tick as the minimum move. IntraBar Order Generation is also set to On.

Here's an example of the code:

Thanks a lot Bob, this is very informative. Currently I'm testing your example code, and came across some things where I don't have a good grip on what you're trying to do.

 
Code
                            
If MarketPosition 1 then LongEntry=0BuySig=0Max=0;
If 
MarketPosition=-1 then SSEntry=9999SSSig=0Min=9999

EasyLanguage manual
EasyLanguage uses the semicolon ( ; ) to mark the end of each statement.

So, if I understand that correctly, in effect this part of the code get read by EasyLanguage as follows:
 
Code
                            
If MarketPosition 1 then begin
                  LongEntry
=0;
  
end;
   
  
BuySig=0
  
Max=0;
   
  If 
MarketPosition=-1 then begin
                  SSEntry
=9999;
  
end;
   
  
SSSig=0
  
Min=9999
Is that also what you mean with that code?

In the code there’s also:
 
Code
                            
 {The Following is a 'Safeguard' for if not Bot or SS due to 2 bars in SAME TIME:} 

I don’t understand what you mean with ‘in same time’, since I don’t see any time related code below that statement. Perhaps I’m focusing too much on the ‘time’ word in your comment, but I can’t see how that comment relates to the code below it.

Edit: Perhaps I've missed it in this thread, but is this a 24 hours, 5 days, strategy? The way I read the strategy (and I'm no expert, so don't take it for granted ) is the following:

 
Code
                            
// Resetting variables every tick between from 15:12 til 15:59
If Time 1511 and Time 1600 then begin
  BuySig 
0
  
SSSig 0
  
Min 9999
  
Max 0;
end;

Condition1 Time 1500;  // Mountain Time        (GMT - 6; UTC - 7)
// Long and short orders need this condition to be true when entering a trade

// Time exit after 15:10
If MarketPosition >= and Time 1510 then 
    Sell next bar at market

Enter trades before 15:00;
Exit open positions after 15:10;
Reset variables between 15:12 and 15:59.

Shouldn't these variables be reset after a trade is closed, so the following trade can use the right values?


Btw, I'm not criticizing you (or you're strategy) Bob, nor do I want to sound as an 'smartass' (if that's the right English word for it).




bomberone1 View Post
Reag again my post please, without back-fill or database costruction, no way to have realistick backtesting.

Correct me if I'm wrong , but isn't this something that the data provider needs to do? For example, if the data provider only provides seconds time stamps, I assume that MultiCharts can't achieve higher precision and that MC has to assume that the data downloaded from the data feed is already in the correct order? Off course, if the data feed provides milliseconds time stamping (which MultiCharts simulates with TickID), then MC also needs to apply TickID to the downloaded data from the data feed. What's your opinion about this Bomberone1? (I'd also love to hear MultiCharts take on this, after they've released their RC off course ).

Anyway, before going further off topic, what kind of data do you use Bob, Rithmic right? I guess you've also backtested on that data?

Regards,

Reply With Quote
Thanked by:
  #87 (permalink)
 
bobbakerr's Avatar
 bobbakerr 
Riverdale, Idaho, USA
 
Experience: Intermediate
Platform: Optimus Futures + MultiCharts + TradeStation
Broker: Optimus Futures, Rithmic Data, TradeStation
Trading: CL, ES
Posts: 115 since Aug 2010
Thanks Given: 241
Thanks Received: 51

Jura, you've asked a lot of good questions. And one especially might have pointed out a flaw in my code. But I don't have the time right now to respond. I hope to get back to this sometime tonight.

Started this thread Reply With Quote
Thanked by:
  #88 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690


bobbakerr View Post
Jura, you've asked a lot of good questions. And one especially might have pointed out a flaw in my code. But I don't have the time right now to respond. I hope to get back to this sometime tonight.

No problem, don't feel pressured to respond immediately. I hope I said something useful.


Jura View Post
[..]
Shouldn't these variables be reset after a trade is closed, so the following trade can use the right values?
[..]

Btw, if you want to reset the variables after exiting a position, it might be worth trying to save the MarketPosition into a variable, so you can reference the MarketPosition value from previous bars (I don't know if you want to do that). Something like this perhaps:

 
Code
                            
Variables:
    
MP(0),                    // Saves the Market Position so it's possible to access previous values
    
barsInPosition(0)     // Example variable which we want to reset
    
;
    
if 
currentbar 1 then cleardebug;    
    
MP MarketPosition;            // Save the MarketPosition in the current value of 'MP'

if MP MP[1then            // If the MarketPosition on this bar is the same as the previous bar, we add one to the counter.
    
barsInPosition barsInPosition 1
else                                // If the MarketPosition on this bar is different than the previous one, reset the counter to 1.
    
barsInPosition 1;

// Print output
Print(Date:6:0"_"time_s:6:0" MarketPosition: "MP" MarketPosition Previous bar: "MP[1],
    
" Bars in Position: "barsInPosition:0:0);

// Default strategy logic below; not relevant for the example
varsquickMA(0), slowMA(0);

quickMA AverageFC(Close10);
slowMA  AverageFC(Close40);

if 
quickMA crosses above slowMA then begin
    Buy next bar at market
;
end;
    
if 
quickMA crosses below slowMA then begin
    SellShort next bar at market
;
end
Which gives the following output:
 
Code
.....
1110516_155557 MarketPosition:    1.00 MarketPosition Previous bar:    1.00 Bars in Position: 10
1110516_155609 MarketPosition:    1.00 MarketPosition Previous bar:    1.00 Bars in Position: 11
1110516_155631 MarketPosition:    1.00 MarketPosition Previous bar:    1.00 Bars in Position: 12
1110516_155648 MarketPosition:    1.00 MarketPosition Previous bar:    1.00 Bars in Position: 13
1110516_155658 MarketPosition:    1.00 MarketPosition Previous bar:    1.00 Bars in Position: 14
1110516_155715 MarketPosition:    1.00 MarketPosition Previous bar:    1.00 Bars in Position: 15
1110516_155737 MarketPosition:    1.00 MarketPosition Previous bar:    1.00 Bars in Position: 16
1110516_155740 MarketPosition:    1.00 MarketPosition Previous bar:    1.00 Bars in Position: 17
1110516_155801 MarketPosition:    1.00 MarketPosition Previous bar:    1.00 Bars in Position: 18
1110516_155851 MarketPosition:   -1.00 MarketPosition Previous bar:    1.00 Bars in Position: 1
1110516_155929 MarketPosition:   -1.00 MarketPosition Previous bar:   -1.00 Bars in Position: 2
1110516_155954 MarketPosition:   -1.00 MarketPosition Previous bar:   -1.00 Bars in Position: 3
1110516_160009 MarketPosition:   -1.00 MarketPosition Previous bar:   -1.00 Bars in Position: 4
1110516_160026 MarketPosition:   -1.00 MarketPosition Previous bar:   -1.00 Bars in Position: 5
...
Just a thought.

Regards,

---------------
Edit: I was trying to simply your 'Safeguard' code piece, and I've noticed something off.

This is your 'Safeguard' code piece from the example strategy:

 
Code
{The Following is a 'Safeguard' for if not Bot or SS due to 2 bars in SAME TIME:}
If MarketPosition=-1 and C of data2<Min then begin
   Min=C of data2; Max=0;
end;
If MarketPosition=1 and C of data2>Max then begin
   Max=C of data2; Min=9999;
end;
If MarketPosition=-1 and C of data2>=Min+.08 then begin
   Buy next bar at LongEntry{InsideAsk} Limit;
end;
If MarketPosition=1 and C of data2<=Max-.08 then begin 
   SellShort next bar at SSEntry{InsideBid} Limit;
end;

If MarketPosition=1 then LongEntry=0; BuySig=0; Max=0;
If MarketPosition=-1 then SSEntry=9999; SSSig=0; Min=9999;


If MarketPosition>=1 and Time>1510 then Sell next bar at market;
If MarketPosition<=-1 and Time>1510 then BuyToCover next bar at market;
Al these MarketPosition > ... statements can be nested with the other if statements, for example:

 
Code
If MarketPosition=-1 and C of data2>=Min+.08 then begin
   Buy next bar at LongEntry{InsideAsk} Limit;
end;
.....
If MarketPosition<=-1 and Time>1510 then BuyToCover next bar at market;
..can be rewritten as:
 
Code
if MarketPosition = -1 then begin

    if Close of Data2 > Min + 0.08 then
        Buy next bar at LongEntry{InsideAsk} Limit;
        
    if Time > 1510 then
        BuyToCover next bar at market;

end;
If you do that for the whole 'Safeguard' code section, you get the following result:

 
Code
                            
// Manage long orders
if MarketPosition 1 then begin

    
// Set 'Max' to 'Close of Data2' if 'Close of Data2' is higher then 'Max'
    // Note: as long as there is a long position, this is always true (see note2 below)
    
if Close of Data2 Max then begin
        Max 
Close of Data2;
        
Min 9999;
    
end;

    
// Flip position from Long to Short if Close is below Max - 0.08
    
if Close of Data2 <= Max 0.08 then 
        SellShort next bar at SSEntry 
{InsideBidLimit;        
        
// Note1: If the Close of Data2 drops below Max - 0.08, is the limit order of 'SSEntry' still achievable,
        //     Or would the current price be to far away to get filled at the 'SSEntry' limit price?

    
LongEntry 0
    
BuySig 0
    
Max 0;                // Note2: this resets 'Max' to 0 *every* time there's a long position

    // Time exit
    
if Time 1510 then
        Sell next bar at market
;
end;

// Manage short orders
if MarketPosition = -1 then begin

    
if Close of Data2 Min then begin
        Min 
Close of Data2;
        
Max 0;        
    
end;

    if 
Close of Data2 >= Min 0.08 then
       Buy next bar at LongEntry
{InsideAskLimit;

    
SSEntry 9999
    
SSSig 0
    
Min 9999;

    if 
Time 1510 then
        BuyToCover next bar at market
;
end
See the comments in the example above - there is one error in there, and one potential error (in my opinion), both for the long and for the short position (though I haven't highlighted it for the short code).

Note: rewritten with the assumption that with ...
 
Code
If MarketPosition=-1 then SSEntry=9999; SSSig=0; Min=9999;
you mean..
 
Code
If MarketPosition=-1 then begin
SSEntry=9999; 
SSSig=0; 
Min=9999;
end;
Otherwise these 4 variables:
 
Code
SSSig = 0; 
Min = 9999;
BuySig = 0; 
Max = 0;
Need to be added at the very end of the rewritten code example, since they "fall" outside of MarketPosition = 1 and MarketPosition = -1 and get triggered everytime (regardless of the MarketPosition value). But in that case, they still would trigger the highlighted condition above in which the Close of Data2 would be greater than 'Max'. At least, that's how I understand it.


I hope this example is somewhat helpful in showing what your code (in my opinion!) does.

Regards,

Reply With Quote
Thanked by:
  #89 (permalink)
 
bobbakerr's Avatar
 bobbakerr 
Riverdale, Idaho, USA
 
Experience: Intermediate
Platform: Optimus Futures + MultiCharts + TradeStation
Broker: Optimus Futures, Rithmic Data, TradeStation
Trading: CL, ES
Posts: 115 since Aug 2010
Thanks Given: 241
Thanks Received: 51

I'm finally back. Yes, Jura, you did find a mistake and it was the one I thought you had found.

My intent was to have the following (wrong) code:
 
Code
                            
If MarketPosition 1 then LongEntry=0BuySig=0Max=0;
If 
MarketPosition=-1 then SSEntry=9999SSSig=0Min=9999
Actually be:
 
Code
                            
If MarketPosition=1 then begin
   LongEntry
=0BuySig=0Max=0;
end;
If 
MarketPosition=-1 then begin
   SSEntry
=9999SSSig=0Min=9999;
end
Changing that, the results for the last 20 to 22 trading days are as follows:
Before the Change:
ES (.25 Range Bars): + 40,064 Net on 324 R.T.'s; 86.1% Success Ratio; -1158 Longest Losing Streak.
CL (.02 Range Bars): + 174,817 Net on 4491 R.T.'s; 55.8% S.R.; -1920 L.L.S.
CL (40-sec. Bars): + 253,007 Net on 3025 R.T.'s; 73.1% S.R.; -4510 L.L.S.
CL (12-Tick Bars): + 31,068 Net on 3312 R.T.'s; 41.3% S.R.; -4048 L.L.S.
Keeping the mistake in, but Re-Loading MultiCharts:
ES (.25 Range Bars): + 42,058 Net on 317 R.T.'s; 86.1% Success Ratio; -1158 Longest Losing Streak.
CL (.02 Range Bars): + 181,391 Net on 4722 R.T.'s; 55.9% S.R.; -2039 L.L.S.
CL (40-sec. Bars): + 296,901 Net on 3036 R.T.'s; 80.3% S.R.; -610 L.L.S.
CL (12-Tick Bars): + 31,703 Net on 3243 R.T.'s; 41.3% S.R.; -4078 L.L.S.
Fixing the Code:
ES (.25 Range Bars): + 41,469 Net on 351 R.T.'s; 81.5% Success Ratio; -1486 Longest Losing Streak.
CL (.02 Range Bars): + 195,792 Net on 5398 R.T.'s; 55.6% S.R.; -2059 L.L.S.
CL (40-sec. Bars): + 296,853 Net on 3038 R.T.'s; 80.3% S.R.; -611 L.L.S.
CL (12-Tick Bars): + 30,876 Net on 3298 R.T.'s; 41.1% S.R.; -3798 L.L.S.

So, the repair of that error did change the results of the 4 test cases slightly.

** However, that 'Safeguard' section should not even be in the code (You also implied that). Why would it be needed if all the above rules are obeyed? And also, I should have said "If a bar has NO VOLUME", instead of 'If 2 bars have the SAME TIME'. The No Volume thing occurs frequently in Range Bars. **



Quoting 
Edit: Perhaps I've missed it in this thread, but is this a 24 hours, 5 days, strategy? ...

No. It is supposed to begin at Midnight (Mountain time) and end at the next bar > 1410 (Mountain time). That way I'm only daytrading and can take advantage of far cheaper Margin.


I've only commented on a couple of the points you bring up. But it's late now for me and I'm going to bed. I'll answer the rest of your Q's hopefully tomorow.

Thanks for your help.

Started this thread Reply With Quote
Thanked by:
  #90 (permalink)
 bomberone1 
London
 
Experience: Beginner
Platform: MultiCharts
Posts: 277 since Nov 2010
Thanks Given: 14
Thanks Received: 29


I think that we could creat a specific post to this strategy where upgrade the version and share the code.
I am looking to understand the concept of trading and after I write my opinion.
My best.

Reply With Quote
Thanked by:




Last Updated on April 4, 2012


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts