Instead of SetForeign use Foreign since you really need only CLOSE price (not OHLC). Better yet - use AddToComposite to calculate composite once only.
Best regards, Tomasz Janeczko amibroker.com ----- Original Message ----- From: kris45mar To: [email protected] Sent: Thursday, April 19, 2007 2:56 PM Subject: [amibroker] Slow FX Indice code: can this be improved? Hi Group I run the MT3 plugin to get FX data in local database with local data storage enabled. This code runs slowly on all time frames, slowing down AB. Not being a programmer I wondered if there was a better way to code this to speed it up a bit. Code is a proxy to see which currencies are currently strong or weak: ******** ******** //FX indexes // ozzie SetForeign("AUDJPY"); AJ = C; SetForeign("AUDUSD"); AU = C; SetForeign("AUDCAD"); AC = C; // EZ SetForeign("EURUSD"); EU = C; SetForeign("EURJPY"); EJ = C; SetForeign("EURCAD"); ECA = C; SetForeign("EURCHF"); ECH = C; SetForeign("EURGBP"); EG = C; // GBP SetForeign("GBPUSD"); GU =C; SetForeign("GBPJPY"); GJ = C; SetForeign("GBPCHF"); GC =C; SetForeign("EURGBP"); EG = C; // YEN SetForeign("USDJPY"); UJ = C; SetForeign("EURJPY"); EJ =C; SetForeign("CHFJPY"); CJ =C; SetForeign("GBPJPY"); GJ = C; SetForeign("AUDJPY"); AJ =C; RestorePriceArrays(); Pound_Index = GU * GJ * GC * (1/EG); OZZIE = AJ * AU * AC; EZ_Index = EU* EJ * ECA * ECH * EG; Yen_Index = -( UJ + EJ + CJ + AJ + GJ); Plot(OZZIE, "Oz_Index", colorGreen, 1); Plot( EZ_Index, "EZ_Index", colorBlue,1 | styleOwnScale); Plot( Pound_Index,"GBP Index",colorBlack, 1 | styleOwnScale); Plot( Yen_Index, "JPY Index", colorRed, 1 | styleOwnScale); ********* ********* While this computes, AB is pretty much non responsive. Any ideas? ChrisB ------------------------------------------------------------------------------ Ahhh...imagining that irresistible "new car" smell? Check out new cars at Yahoo! Autos.
