Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.
alex_laxya
Members-
Content Count
61 -
Joined
-
Last visited
Content Type
Profiles
Forums
Calendar
Articles
Everything posted by alex_laxya
-
compulsory boot-camp with fee of 2500$ means they dont target there s/w for experience traders. Thanks for the reviews.
-
Thanks blowfish, and yes if there is a debate over bid-ask vs uptick-downtick then i will take a side of uptick-downtick, i dont believe bid-ask order directly affect the price structure, other time frame traders ( which are the most influencial one to change the shape of a profile ) trades on higher time frame & logically they will wait on bid rather than hitting the ask price aggressively, yes bid-ask has a value but mostly for quants who uses the imbalance in a flash. Whereas uptick-downtick itself is the product of price movement so is more reliable market induced information imho.
-
After reading this much informative thread from start to end there one confusion still lies, how OFA Change the bar? is it pnf as someone said above or is it using variation of CD Algo? Most of guys must have used it by now, how was the real time experience?
-
For multi chart users, how you guys back test intra bar order for day trading strategies? I tried those methods like checking intrabar generation also used within code etc but it never worked for me. Ex. In backtest MC should reflect exact Buy price at the market when high of the current bar > previous high. Strangely unlike market delta, MC doesnt facilitate simple buy order like buy this bar at variable # x where as variable # x holds the value of high of current bar > previous high. Am i missing something obvious in MC ? It restricts market order on next bar only not present bar. :pullhair:
-
Futures and Options Related Stats.
alex_laxya replied to alex_laxya's topic in Market News & Analysis
Thats the point, derivatives in emerging markets is really in nascent stage, ATM open interest has one more substitution which i practice, average out oi of 10 most active contracts for puts and calls for current series and divide. Instead of volume if bid - ask data analysed then picture will get more clear provided data is pure tick data & not snapshot. -
Please post your experience regarding above subject. How you guys put those futures and options related stats in trading context ? And what is your experience using then. I myself use option related data for day trading in indian market ( nifty future ) & put that data in context with auction theory to make sense of the information and avoid bias opinion. I have some limitations to back test those trading ideas 'cuz of limitations of hystorical option related data (IEOD). I wonder if that data is available for other exchanges and some one backtested ?
-
Yes I am talking about dev POC, way to tackle this problem is divide back testing frequency to 6 month each ? Volume breakdown indicators also giving the same error . Add/edit - problem with using profile token instead of TPO is value areas wont follow along with intraday price and i am backtesting day trading system, profile tokens are handy for reference indicators or confirm rule.
-
Cant agree more than this, very very easy to code in Investor/RT.Especially one is discretionary trader and just want to back test few concepts real quick without much of a programming knowledge then Investor/RT is helpful. Gone through the thread from start to end but i haven't found any comments on coding market profile related indicators/signals.I used trade station as charting software but market profile and auction market related codes are tough to make. One problem i am facing in Investor/RT while back testing is TPO related codes give error signals when backtest on more than 3 months data, it give accurate signals ( say exit at POC) from current to last 90 days but afterwords it start giving error signals( data is esig)
-
Topic Of The Month March, 2009
alex_laxya replied to Soultrader's topic in Announcements and Support
I found this post on "Re: MP for NSE INDEX AND OPTIONS" interesting and have nominated it accordingly for "Topic Of The Month March, 2009" -
It was just sample chart, not my trade setup, in first window is nifty, NIFTY is same as s&p500, most liquid index derivative contract, in second window its vix ( mathematical formula of nsevix is same as cboe vix ) in third window is oipcr By arrow i suggested the practical use to get directional sense. While there r other things as well, instead of depending completely on it i try to put this data in overall context and also there r few things like oipcr has historical resistance at 169-1.75 zone ( in this one year old so called bear cycle )also need of smoothing the data to reduce the noise without getting delay response etc..to make a more reliable and logical combination, more i posted here http://www.traderslaboratory.com/forums/6/mp-for-nse-index-and-options-5518-3.html scroll down to post 29,later half of the section, posted the chart over there for trading setup. vix_comp_meth.pdf
-
Hi frank nice observations. I am an option writer, but I trade in Indian markets not much in s & p ..but option market is somewhat same. I use VIX and OI PCR( open interest put call ratio ) in my trades. what I do is, i divide open interest put call ratio by VIX which gives directional bias of the underlying price moves, rising vix is indirectly proportional to price movements in this case s&p500 and oi pcr is directly proportional to price moves. OIPCR rises when there is comparatively higher put writing than call writing, very few times vix rises and oipcr rises, then net change of vix/oipcr is almost zero and so filter out the noise without getting delay, but most of the time there is more put writing happens when vix is falling and so oipcr rises, on rising vix there is comparatively more call writing happens indicating weakness in markets, and for option writer, writing call option is safer bet than writing put option as probability model skewed towards fall, speed of fall is more than speed of rise in prices… Hope to get other interesting ideas on vix from other known members and pardon me for such a long post. Alex
-
Elongated profile with steady distribution, usually such kind of profile is healthy and indicates strength but volume is an issue, b'cuz of sun outage few brokers facing connectivity issues 2500 pe witnessed large activity, o.i. jumped by 12 lk which is again indicates the strength. Best wishes for weekend Alex
-
Sorry frnd, i trade actively so whenever possible try to update chart in RT as per time permits...
-
ELONGATED PROFILE BY NOW..LOW VOLUME..HITTING Y.VALUE AREA..
-
Time, price,volume and 4th factor Lets start from the very foundation of market profile .. who are the auction partcipants ? . Local market makers . Day traders . Intermediate-swing traders . Long time frame traders This auction create market-generated information, auction organize and reflect the attitudes of the market's partcipants,thus creating market-generated information. The key to reading market-generated information is .Time .Price .Volume This i sthe primary tool of market profile now there is another time of auction involved ..auction of option buying and option selling.. option sellers are considered as Smart Money, though there r verious contradictory theories, lets not get in to this, but Indian market is special in this sense, option market hasnt yet developed and there r normally in the month options are liquid and those only of nifty index, there is still attraction of quick money among this high volatility ( vix) higher vix means greater fear which by standard mathematical model increase the option premium This option induced data is very meangful when look in to context of market profile, i am not a great reader of volume distribution but i found option induced information very profitable in my trading... there ant any secrets in trading and nor i intend to have one, its about the art and how u adjust ur knowledge to earn money, which come by practice.. In this thread, now and then i will try to explain market profile using 4th factor/ dimension as option open interest i assume every one knows te calculations of option open interest put call ratio which i extensively use in my trades.. here is the chart explaining todays activity ( plz note o.i.pcr is daily ) ..there is a build up of 92 lk o.i. around 2500 pe ( not shown in chart ) and this build up is since last few days, but still oi pcr is decreasing which indicates there is call writing ahppening around resistance zone or u can say most strong value areas, If 2500 nifty broke ( which we proved mathematically an important psychological area) then there wd be heavy selling from other time frames.
-
I think you cant edit your post after some time... just found i accidentally posted the wrong chart on post no. 25...correct chart shows in post no. 26 Request to moderator, plz delete my post no.25..meanwhile plz ignore that post... sorry for confusion Alex
-
I think you cant edit your post after some time... just found i accidentally posted the wrong chart on post no. 25...correct chart shows in post no. 26 Request to moderator, plz delete my post no.25..meanwhile plz ignore that post... sorry for confusion Alex
-
As mentioned in last post market profile is looking very bearish establishing new lower value areas daily, even rate cuts wont able to boost the prices.This is where MP comes handy, MP allows to see what market is actually telling and help us not to mix our own feelings/impulse to the information. As mentioned before, trying to add the angle of VIX and option open interest put call ratio in next post ..heading for break .. Alex
-
As mentioned in last post market profile is looking very bearish establishing new lower value areas daily, even rate cuts wont able to boost the prices.This is where MP comes handy, MP allows to see what market is actually telling and help us not to mix our own feelings/impulse to the information. As mentioned before, trying to add the angle of VIX and option open interest put call ratio in next post ..heading for break .. Alex
-
thanks mathew..and thanks my all older friends out here ( u knw what i mean ) .. we open with y.day value area ..and moved down..profile is elongated, signifies trend, right nw we on lower side of inside bar ( hourly ) ..
-
After big move down today market try to regain the balance as shown in chart todays price movement was within y.days inside bar..red lines indicates prev value area, after market hours we got news of 50 bps rate cut, whether its already in price or not market will tell us.. but the resistance zone clearly would be previous value area which coincide with break out target of inside bar ( range of IB is b.o. projection ) As its very obvious since when market shifted down from those value areas more volume attracts other time frames, in MP terms advertisement of the price below value area been confirmed by higher volumes which confirm the weakness so even on gap up/ move up market has heavy resistance around 2775. The indicator dominant period is depend on ehlers MESA( maximum entropy ), its totally different subject all together just put here as m studying on it to understand cycles and reversals to sharpen profile study ( any one interested can look at mesasoftware.com ) p.s. my intention is only sharing information i dont have any vested interest in above link, if its against forums policy happy to delete it. Alex
-
Taq... basically market profile is not an indicator, it gives structure to the market generated information which facilitates to understand the market ( whether in range, trend etc ) ..my approach is i mix it with my trading method ( which is discretionary not particular one system ) ..it helps me to book my profits before trend reverse or get out on wrong trade as quickly as possible.. uses r limitless when u in sync with the market ... through my posts my approach will gradually unfolds hard to frame it in words...ur comments r always welcome goin to post strategy for tomorrows market with the help of whatever market generated information we have..
-
In above chart 'D' denotes where market open, days profile has been divided in 30 min tf ..market open below yesterday's value area and as day progressed range expanded towards upside, green color indicates POC which was steadily moving upwards.Most of the day profile was balanced, in last closing hour market close on upside but below prev value area.
-
lolllzz glad to see you here dumdum... yaa TL has separate section on Market Profile, and on other TA methods as well ..go through sticky thread on MP, good video tutorials.
-
sorry frnds cant able to attach afl ( convert in to txt )...if u can see the attachment then plz use it :rofl: new to post here, burn my half an hour :crap: here copy pest above afl //File: AB - Market Profile - 171 //version 1.71 _N(FileName = "Market Profile 1.71"); _N(VAP_Version = "1.71"); // //December 17, 2007 // // // //Market Profile based on volume distribution //Program plots volume at price for various time frames as specified by parameters. //Program also displays the instantaneous volume and cumulative volume for the chosen time frame at bottom of screen. // // //Known Issues: version 1.71 //Program has been tested with QP data for EOD and eSignal and iqfeed for real time. //Code works well for EOD data. //Real time has 2 issues: // 1. Occasionally display has to be shrunk or expanded to display properly. // the problem arises from computing the first visible bar and Quick AFL changing the number of bars available // when time frames are changed or dissplay is shrunk or expanded. // 2. Real time display is organized in two groups. Display for one full day and display shorter time periods. // The shorted time periods do not work properly and the opions is inhibited in the parameter settings. // //The code is heavy on CPU usage and it is useful to run it once at the end of each bar for real time. //Compiling code may be useful in speeding up execution. // // //SetBarsRequired(10000,0); // Functions - Real time data: Compute_RT_Intraday_1, Compute_RT_Daily, Compute_EOD_Weekly, // Functions - EOD Data: Compute_EOD_Monthly, Compute_EOD_Quarterly // Functions - FindFirstBar, DataCollect, DataReconstruct, PlotChart, PlotVolumeStats, Plot_POC_UVA_LVA. // Functions - Verify Volume - Generate error message if volume is not available // Functions - UpdateDynamicVars - Create names for dynamic variables // Functions - ComputeDataBlockParms - Compute values for each block. Use start and end markers for blocks // //globals. VMP prefix used for all globals so they are unique to this module. // // ========================================================================================================= // // SETUP // Time marker should be set up at begining of bar // // ========================================================================================================= // ///SetBarsRequired(1000,0); VMP_Control = 0; // Controls whether parameters are local or controlled from calling program // VMPperiods = 0; // Number of block of data (weeks, months etc.) VMPDispPeriod = ""; // Used in title VMPNumSteps = 150; // Number of price steps for entire range VMPPeriod_High = 0; // High price for a specific data block (period) VMPPeriod_Low = 0; // Low price for a specific data block (period) VMPStartBar = 0; // First bar in a data block VMPEndBar = 0; // Last bar in a data block VMPNumdays = 0; // Number of bars in a data block VMPPrice_Step = 0; // Price increment per volume bucket VMPMin_Price = 0; // Min Price for visible range - not needed?? also associated code VMPMax_Price = 0; // Max Price for visible range - not needed?? // // VMP_Group_PeakVolume = 0; VMPDisplay_Block = ""; VMPVol_Error = ""; // // Create root for dynamic variables VMP_GroupPeakVol = ""; VMP_BlockStartBar = ""; VMP_Blockvol = ""; VMP_BlockVol1 = ""; VMP_BlockVol2 = ""; VMP_BlockPeakVol = ""; VMP_NumDays = ""; VMP_MinStep = ""; VMP_MaxStep = ""; VMP_BlockHigh = ""; VMP_BlockLow = ""; //Compute Data Interval //Variables: EOD, Weekly, Monthly, RT, DateStamp, MDYear, TimeStamp EOD = IIf(Interval() > 80000 AND Interval() < 100000,1,0); Weekly = IIf(Interval() > 100000 AND Interval() < 1000000,1,0); Monthly = IIf(Interval() > 2000000,1,0); RT = IIf(Interval() < 23401,1,0); //Compute Date Y1 = Year(); M1 = Month(); D1 = Day(); _N(DateStamp = WriteVal(M1,1.0) + "/" + WriteVal(D1,1.0) + "/" + WriteVal(Y1,1.0)); _N(DateStamp2 = WriteVal(M1,1.0) + "-" + WriteVal(D1,1.0) + "-" + WriteVal(Y1,1.0)); //Compute Time Hr = Hour(); Mn = Minute(); Sc = Second(); _N(TimeStamp = WriteVal(Hr,1.0) + ":" + WriteIf(Mn<10,"0","") + WriteVal(Mn,1.0) + ":" + WriteIf(Sc<10,"0","") + WriteVal(Sc,1.0) + WriteIf(Hr<12,"am","pm")); // **************************************************************************** if (RT==0) { VMP_TimeFrame = Param("1=Q, 2=M, 3=W",2,1,3,1); } else { VMP_TimeFrame = Param("4=Day, 5=Int",4,4,4,1); VMP_Mini_Period = Param("Mini Period",60,20,120,10); } VMP_Scaling = Param("Scaled=0, Full=1",1,0,1,1); VMP_Periods = Param("Num Periods",0,0,15,1); VMP_Vol_Plot = Param("Vol_Plot",1,0,1,1); Debug_ = Param("Debug",1,0,1,1); // VMP_Stat = Status("action"); Debug = Debug_ AND VMP_Stat ==1; // // //Amibroker Status //Preferences set to mark time at "06:30" and "13:10" //Time stamp must be for start of bar VMP_StartTime = 63000; VMP_EndTime = 131000; Minutes_perday = 405; // bar_Index = BarIndex(); Lastbar_Index = BarCount-1; LastBar_Number = LastValue(BarIndex()); // // // // // ============================== Start Functions ================================ //Function Definitions // // ======================== Start Function ComputeDataBlockParms ========================== // // function VerifyVolume() { // Verify that volume is available Vol_Test = IIf(LastValue(Sum(Volume,10)),1,0); return Vol_Test; } // // function UpdateDynamicVars(m) { VMP_GroupPeakVol = "VMP:GroupPeakVol"; VMP_BlockStartBar = "VMP:BlockStartBar_" + NumToStr(m,1.0); VMP_Blockvol = "VMP:Blockvol_" + NumToStr(m,1.0); VMP_BlockVol1 = "VMP:BlockVol1_" + NumToStr(m,1.0); VMP_BlockVol2 = "VMP:BlockVol2_" + NumToStr(m,1.0); VMP_BlockPeakVol = "VMP:BlockPeakVol_" + NumToStr(m,1.0); VMP_NumDays = "VMP:NumDays_" + NumToStr(m,1.0); VMP_MinStep = "VMP:MinStep_" + NumToStr(m,1.0); VMP_MaxStep = "VMP:MaxStep_" + NumToStr(m,1.0); VMP_BlockHigh = "VMP:BlockHigh_" + NumToStr(m,1.0); VMP_BlockLow = "VMP:BlockLow_" + NumToStr(m,1.0); } // // function ComputeDataBlockParms(j,Time_Block) { VMPNumdays = LastValue(ValueWhen(Time_Block==2 OR Time_Block==3,BarsSince(Time_Block==1 OR Time_Block==3),j)) +1; VMPStartBar = LastValue(ValueWhen(Time_Block==1 OR Time_Block==3,Bar_Index,j)); // VMPEndBar = VMPStartBar + VMPNumdays-1; // VMPPeriod_High = LastValue(Ref(HHV(High,VMPNumdays),-(LastBar_Number - VMPEndBar))); VMPPeriod_Low = LastValue(Ref(LLV(Low,VMPNumdays),-(LastBar_Number - VMPEndBar))); // if (VMPEndBar > LastBar_Number) _TRACE("VMP171-DBP-0 - End Bar " + VMPEndBar + " Last Bar " + LastBar_Number); if (Debug==1) { _TRACE("VMP171-DBP-1 - j " + j + " StartBar " + VMPStartBar + " Numdays " + VMPNumdays + " EndBar " + VMPEndBar + " PHigh " + VMPPeriod_High + " PLow " + VMPPeriod_Low); } } // // // // ============================ end function ComputeDataBlocks ============================= // // // ================================= start function FindFirstBar ================================ // //Compute number of bar on screen function FindFirstBar(TimeFrame) { Max_price_ = Min_price_ = Bars = 0; BarsperInterval = 0; // if (VMP_Stat ==1) { // if (TimeFrame ==5) { Bars = LastValue(BarsSince(TimeNum()==VMP_StartTime)) + 1; } else { FirstBar = LastBar_Number - Status ( "firstvisiblebar") - bar_index[0]; // result is in array index domain (not barindex). LastBar = LastBar_Number - Status ( "lastvisiblebar") - bar_index[0]; Bars = FirstBar - LastBar; Bars = LastBar_Number - Status ( "firstvisiblebar") - bar_index[0]; // original _TRACE("VMP171-FFB - FirstBar " + FirstBar + " LastBar " + LastBar + " Bars " + Bars + " FVBar " + Status ( "firstvisiblebar") + " BarCount " + BarCount); } // // SetBarsRequired(Bars,0); // // Compute max number of blocks possible with number of bars available Max_price_ = LastValue(HHV(High,Bars)); // original Min_price_ = LastValue(LLV(Low,Bars)); _TRACE("VMP171-FFB-0 - min Price " + Min_price_ + " max price " + Max_price_); /* Max_price_ = LastValue(Ref(HHV(High,Bars),-LastBar)); Min_price_ = LastValue(Ref(LLV(Low,Bars),-LastBar)); */ if (debug) _TRACE("VMP171-FFB-1 - Bars " + Bars); } // if (VMP_Periods ==0) { //if VMP_Periods is set to zero, compute periods dynimically switch(TimeFrame) { case 1: VMP_Periods = int(Bars / 66); break; // Quarter case 2: VMP_Periods = int(Bars / 21); break; // Month case 3: VMP_Periods = int(Bars / 5); break; // Week // Below using ceil() instead in int() allows an extra bar making it possible for 60 and 120 min bars to work properly case 4: BarsperInterval = ceil(Minutes_perday * 60 / Interval(0)); VMP_Periods = ceil(Bars / BarsperInterval); break; // Day //case 5: BarsperInterval = int(VMP_Mini_Period * 60 / Interval(0)); // VMP_Periods = int(Bars / BarsperInterval) +0; break; // Intraday } // end switch } // end VMP_Periods ==0 /* else xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx { //Insure that number of periods specified are possible within the available bars. xxxxxxxxxxxxxx switch(TimeFrame) { case 1: VMP_Periods = int(Bars / 66) +0; break; // Quarter } } */ // // // Price_Range = Max_Price_ - Min_Price_; // //These 3 variables are used later on VMPPrice_Step = Price_Range / VMPNumSteps; //Offset Max and Min Prices to avoid problems when Max_price = High ...etc VMPMax_Price = Max_Price_ + (0.01 * Price_Range); VMPMin_Price = Min_Price_ - (0.01 * Price_Range); // if (debug) { _TRACE("VMP171-FFB-2 - FindFirst - Bars " + Bars + " Periods " + VMP_Periods + " Min " + Min_Price_ + " Max " + Max_Price_); _TRACE("VMP171-FFB-3 - PriceRange " + Price_Range + " NumSteps " + VMPNumSteps + " PriceStep " + VMPPrice_Step); } return Bars; } // end function FindFirstBar // // =================================== end FindFirstBar ================================== // // ======================== Start Function Compute_RT_Intraday_1 ========================== // // function Compute_RT_Intraday() { LB = SB = 0; Bars_perblock = 0; //Define function parameters //Compute following variable for future use // //Items below are applicable for entire day. Need to be processed only once per day (m==1) // VMPDispPeriod = "Intraday"; VMPDisplay_Block = "Time Block " + NumToStr(VMP_Mini_Period,1.0) + " Minutes"; // // //Find bars on screen and copmute screen parms //FirstBar = FindFirstBar(VMP_TimeFrame); // xxxxxxxxxxxxxxxxxxxxxxxxxxxx // //Find number of bars since start of day //Computed for real time Bars_past = LastValue(BarsSince(TimeNum()==VMP_StartTime)) + 1; _TRACE("BarsPast - Bars " + Bars_Past); //SetBarsRequired(Bars_Past + 20,0); // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //Compute number of timeblocks as defined in "minitimes" timeBlocks_1 = int(LastValue(Bars_past *Interval() / 60 / VMP_Mini_Period)); // completed timeblocks timeBlocks_2 = LastValue(Bars_past *Interval() / 60 / VMP_Mini_Period); // completed timeblocks + one in progress // //Total number of timeblocks if (TimeBlocks_1 == TimeBlocks_2) { //All time blocks are completed (on last bar of block) TimeBlocks = TimeBlocks_1; } else { //Time blocks completed plus in progress TimeBlocks = TimeBlocks_1+1; } // VMPPeriods = Timeblocks; // Bars_PerBlock = VMP_Mini_Period * 60 / Interval(); // // //Define starting bar for day Start_bar = LastValue(ValueWhen(TimeNum()==VMP_StartTime,Bar_Index,1)); _TRACE("BarsPast - Start Bar " + Start_Bar + " Last bar " + LastBar_Number); // // //Mark array with 1=Start, 2=end of TimeBlock if (debug==1) { _TRACE("VMP171-RTI-1 - Initial Vars - minitimes " + VMP_Mini_Period + " TimeNum " + TimeNum() + " STime " + VMP_StartTime + " Bars Past " + Bars_Past); _TRACE("VMP171-RTI-2 - BarsPast " + Bars_Past); // // Total bars current day _TRACE("VMP171-RTI-3 - TB1 " + TimeBlocks_1 + " TB2 " + TimeBlocks_2 + " T Blocks " + TimeBlocks ); } // // // //Find starting and ending bars for each time block - Loop x=0; do { if (debug==1) { _TRACE("VMP171-RTI-4A - Status " + VMP_Stat /*+ " Trade_Period " + Trade_Period*/ + " x= " + x + " TB " + Timeblocks); } //Last time block TB = TimeBlocks-1; if (x==TB) { //if there is only one timeblock, then block may not be complete. last bar is last bar of data SB = Start_Bar + (x*(Bars_PerBlock)) - Bar_Index[0]; LB = LastBar_Number - Bar_Index[0]; // if (debug==1) { _TRACE("VMP171-RTI-4B - TB " + TB + " SB " + SB + " LB " + LB); } } // end x==TB else { //Data block is complete SB = Start_Bar + (x*(Bars_PerBlock)) - Bar_Index[0]; LB = Start_Bar + ((x+1)*(Bars_PerBlock)) - 1 - Bar_Index[0]; // if (debug==1) { _TRACE("VMP171-RTI-4C - TB " + TB + " SB " + SB + " LB " + LB); } } // end if x==TB // //if only one bar exists in a new timeblock (SB==LB), mark it as starting bar. if (SB==LB) { //First bar of time block Time_Block[sB] = 1; // if (debug==1) { _TRACE("VMP171-RTI-4D - TB " + TB + " SB " + SB + " LB " + LB + " SB Mark " + Time_Block[sB] + " LB Mark " + Time_Block[LB]); } } // end SB==LB else { //Mark starting bar as "1" and ending bar as "2" Time_Block[sB] = 1; Time_Block[LB] = 2; // // if (debug==1) { _TRACE("VMP171-RTI-4E - TB " + TB + " SB " + SB + " LB " + LB + " SB Mark " + Time_Block[sB] + " LB Mark " + Time_Block[LB]); } } // end if (SB==LB) // if (debug==1) { _TRACE("VMP171-RTI-5A - Status " + VMP_Stat /*+ " Trade_Period " + Trade_Period*/ + " x= " + x + " SB= " + SB + " LB= " + LB + " Last Bar# " + LastBar_Number + " #Bars " + Bars_PerBlock); _TRACE("VMP171-RTI-5B - SB Mark " + Time_Block[sB] + " LB Mark " + Time_Block[LB]); } // x++; } while (x < TimeBlocks AND x <30); // Time_Block[LB] = IIf(Time_Block[LB]==1,3,2); // Modify last bar if ==1 // Entire day has been marked for each intraday segment // return Time_Block; } // end function RT_Intraday // // // =============================== end function RT_Intraday_1 ================================= // // ============================= start function Compute_RT_Daily ============================== // //Time block = 1 full day function Compute_RT_Daily() { //Items below are applicable for entire day. Need to be processed only once per day (m==1) //Should be placed in static variables // //m=0; TimeBlocks = VMP_Periods; // //Daily VMPDispPeriod = "Day"; VMPPeriods = VMP_Periods; VMPDisplay_Block = "Time Block 1 Day"; // // Specify number of minutes based on issue (Futures =400, Stocks=390 and change start stop times) Bars_PerBlock = (Minutes_perday * 60 / Interval(0)) +1; // for debug only // // //Start_bar = ValueWhen(TimeNum()==VMP_StartTime,Bar_Index,1); // //Mark Starting and ending bars of each timeblock. if (VMPDispPeriod =="DayNight") // Day and Night { //Need debug Time_Block = IIf(TimeNum() >=Start_Time AND Ref(TimeNum(),-1) <Start_Time,1, IIf(TimeNum() <=End_Time AND Ref(TimeNum(),1) >End_Time,2, // same as TimeNum()==End_Time??? IIf(LastBar_Number==Bar_Index AND TimeNum() < End_Time,2,0))); } else // Regular trading hours only { Time_Block = IIf(TimeNum() >=VMP_StartTime AND DateNum() > Ref(DateNum(),-1),1, IIf((TimeNum() <=VMP_EndTime AND DateNum() < Ref(DateNum(),1)) OR TimeNum() == VMP_EndTime,2, IIf(LastBar_Number==Bar_Index AND TimeNum() < VMP_EndTime,2,0))); } Time_Block[Lastbar_Index] = IIf(Time_Block[Lastbar_Index]==1,3,2); // Modify last bar if ==1 // // if (Debug ==1) { _TRACE("VMP171-RTD-1 - Inital Vars - Trade Period " + Bars_PerBlock + " T Blocks " + TimeBlocks + " B_Block " + Bars_PerBlock); } return Time_Block; } // end function RT_Daily // // // ============================= end function Compute_RT_Daily ============================== // // ============================= start function Compute_EOD_Weekly ============================== Time_Block = 0; function Compute_EOD_Weekly() //Weekly { // // //Weekly VMPDisplay_Block = "Time Block 1 Week"; VMPDispPeriod = "Week"; VMPPeriods = VMP_Periods; // /* for (i=BarCount-10; i<BarCount; i++) { // if (debug) { _TRACE("VMP171-TB-Week - Index " + BarCount); } // */ Time_Block = IIf(DayOfWeek() < Ref(DayOfWeek(),-1),1, // first day of week IIf(DayOfWeek() > Ref(DayOfWeek(),1),2,0)); // last day of week Time_Block[Lastbar_Index] = IIf(Time_Block[Lastbar_Index]==1,3,2); // Modify last bar if ==1 // // LBI = BarCount-1; // /* for (i=BarCount-10; i<BarCount; i++) { _TRACE("VMP171-TB-Week - Periods " + VMPPeriods + " Bar_Index " + i + " Time_Block " + Time_Block + " LBI " + BarCount); } // } // end Barcount loop */ return Time_Block; } // end function EOD_Weekly // // // ============================= end function Compute_EOD_Weekly ============================== // // ============================= start function Compute_EOD_Monthly ============================== // function Compute_EOD_Monthly() { //Export variables: Numdays, Period_High, Period_Low // if (Debug ==1) { _TRACE("VAP53-EOD-M1 - Enter Monthly function"); } // VMPDisplay_Block = "Time Block 1 Month"; VMPPeriods = VMP_Periods; VMPDispPeriod = "Month"; // //Problem area with last bar being 1st bar of timeblock Time_Block = IIf(Day() < Ref(Day(),-1),1, // first day of month IIf(Day() > Ref(Day(),1) OR (Day() > Ref(Day(),-1) AND Bar_Index==LastBar_Number),2,0)); // last day of month Time_Block[LastBar_Index] = IIf(Time_Block[LastBar_Index]==1,3,2); // Modify last bar if ==1 // if (Debug ==1) { for (i=LastBar_Number-Bar_Index[0]-10; i<=LastBar_Number-Bar_Index[0]; i++) { //_TRACE("VMP171-TB-Month - Last Number " + LastBar_Number + " Last Index " + LastBar_Index + " B0 " + Bar_Index[0] + " BarCount " + BarCount); //_TRACE("VMP171-TB-Month - Periods " + VMPPeriods + " Bar_Index " + i + " Time_Block " + Time_Block + " LBI " + LastBar_Number); } } return Time_Block; } // end function EOD_Monthly // // // ============================= end function Compute_EOD_Monthly ============================== // function Compute_EOD_Quarterly() { //Export variables: Numdays, Period_High, Period_Low // if (Debug ==1) { _TRACE("VAP170-EOD-Q1 - Enter Quarterly function"); } // VMPDisplay_Block = "Time Block 1 Quarter"; VMPPeriods = VMP_Periods; VMPDispPeriod = "Quarter"; // //Problem area with last bar being 1st bar of timeblock Time_Block = IIf((Day() < Ref(Day(),-1) AND Month()==1) OR (Day() < Ref(Day(),-1) AND Month()==4) OR (Day() < Ref(Day(),-1) AND Month()==7) OR (Day() < Ref(Day(),-1) AND Month()==10),1, // first day of quarter IIf((Day() > Ref(Day(),1) AND Month()==3) OR (Day() > Ref(Day(),1) AND Month()==6) OR (Day() > Ref(Day(),1) AND Month()==9) OR (Day() > Ref(Day(),1) AND Month()==12) OR (Day() > Ref(Day(),-1) AND Bar_Index==LastBar_Number),2,0)); // last day of quarter Time_Block[LastBar_Index] = IIf(Time_Block[LastBar_Index]==1,3,2); // Modify last bar if ==1 // if (Debug ==1) { for (i=LastBar_Number-Bar_Index[0]-10; i<=LastBar_Number-Bar_Index[0]; i++) { //_TRACE("VMP171-TB-Month - Last Number " + LastBar_Number + " Last Index " + LastBar_Index + " B0 " + Bar_Index[0] + " BarCount " + BarCount); //_TRACE("VMP171-TB-Month - Periods " + VMPPeriods + " Bar_Index " + i + " Time_Block " + Time_Block + " LBI " + LastBar_Number); } } return Time_Block; } // end function EOD_Quarterly // // // ===================================== end function Quarterly =================================== // // // // // ================================= end function FindFirstBar ================================ // // ================================= start function Data Collect ================================ // function DataCollect(TimeFrame) { // // FirstBar = FindFirstBar(TimeFrame); //Vars defined: VMP_Periods, Price_Range, VMPPrice_Step, VMPMax_Price, VMPMin_Price. // if (Debug==1) { _TRACE("VMP171-DC-01 - Status " + VMP_Stat + " Interval " + Interval() / 60 + "min" + " T Period #" + TimeFrame); _TRACE("VMP171-DC-02 - Visible High / Low - Max_Price " + WriteVal(VMPMax_Price,1.2) + " Min_Price " + WriteVal(VMPMin_Price,1.2) + " F Bar " + Firstbar + " LastBar " + LastBar_Number); } GetPerformanceCounter( bReset = True ); // //Variables // //Compute Time_Block array - Mark start and end date bars //Includes all time blocks //Vars defined: VMPPeriods, Time_Block. - VMP_Periods dynamically defined above is assigned to VMPPeriods switch(TimeFrame) { case 1: Time_Block = Compute_EOD_Quarterly(); break; case 2: Time_Block = Compute_EOD_Monthly(); break; case 3: Time_Block = Compute_EOD_Weekly(); break; case 4: Time_Block = Compute_RT_Daily(); break; case 5: Time_Block = Compute_RT_Intraday(); break; } // //create data sets (set is a month, week, day etc) //m represents the period number m=0; // do { //loop on period - month / week m++; //Define time frame period //Get StartBar, EndBar and Numdays //Process Block Parms j = VMPPeriods - m + 1; //Variables Returned below as Globals //VMPNumdays, VMPStartBar, VMPEndBar, VMPPeriod_High, VMPPeriod_Low ComputeDataBlockParms(j,Time_Block); // // Block_MaxStep = VMPNumSteps - int((VMPMax_Price - VMPPeriod_High) / VMPPrice_Step); Block_MinStep = int((VMPPeriod_Low - VMPMin_Price) / VMPPrice_Step); // if (Debug==1) { _TRACE("VMP171-DC-031 - j " + j + " Status " + VMP_Stat + " m " + m + " Numdays " + VMPNumdays + " Start Bar " + VMPStartBar + " End Bar " + VMPEndBar); _TRACE("VMP171-DC-032 - j " + j + " Block MinStep " + Block_MinStep + " Block MaxStep " + Block_MaxStep); _TRACE("VMP171-DC-033 - MaxPrice " + VMPMax_Price + " PeriodHigh " + VMPPeriod_High + " Priceperstep " + VMPPrice_Step); } // // //LOOP THRU DAILY DATA //Loop through each day of period //need to estalish max vol for each segment, then scale appropriately for charting. //Total Volume for period // //Variables for entire data block Sum_Volume_d1 = LastValue(Ref(Sum(Volume,VMPNumdays),-((LastBar_Number - VMPEndBar)))); // Sum of daily volume for data block Sum_Volume_d2 = 0; // alternate to above Block_MaxVol = 0; // max volume step for data block // //Variables for single bar only Bar_Steps = 0; // Number of price steps Bar_MaxStep = 0; // Highest number step Bar_MinStep = 0; // Lowest number step DayVolume = 0; // Total volume for bar Bar_Volume = 0; // Total volume for bar - (alternate for above) // if (debug) { _TRACE("VMP171-DC-03A - VMPstartbar " + VMPstartbar + " VMPEndBar " +VMPEndBar); } // //initialize dynamic variables to zero in order to keep correct values //These variables will keep data for entire block. One variable for each step of each block //Variables are the equivalent of an array in the form of Var[m,i] // mm = NumToStr(m,1.0); for (i=1; i<=VMPNumSteps; i++) { VMP_Vol = "VMP_Vol_" + mm + "_" + NumToStr(i,1.0); VarSet(VMP_Vol,0); } // // // Block_Volume = 0; Peak_BlockVol = 0; for (dd=VMPstartbar; dd<=VMPEndBar; dd++) { if (debug) _TRACE("VMP171-DC-04-0 - dd " + dd + " BI0 " + Bar_Index[0] + " VMP_Start bar " + VMPstartbar); //Calculate volume attributable to each step with price bar Bar_Volume = Volume[dd-Bar_Index[0]]; // Volume for the day Bar_High = High[dd-Bar_Index[0]]; Bar_Low = Low[dd-Bar_Index[0]]; // Bar_MaxStep = VMPNumSteps - int((VMPMax_Price - Bar_High) / VMPPrice_Step); // Highest step number (fisrt step with no volume above bar) Bar_MinStep = int((Bar_Low - VMPMin_Price) / VMPPrice_Step); // Lowest step number (fisrt step with no volume below bar) Bar_Steps = Bar_MaxStep - Bar_MinStep +1; Vol_perstep = Bar_Volume / Bar_Steps; // Sum_Volume_d2 = IIf(1,Sum_Volume_d2 + Volume[dd-Bar_Index[0]],0); // Sum of daily volume for timeblock - compare value with d1 // // if (Debug==1) { _TRACE("VMP171-DC-04 - daily loop2 - Status " + VMP_Stat + " Start Bar " + VMPStartBar + " dd= " + dd + " EndBar " + VMPEndBar + " BarCount " + LastBar_Number); _TRACE("VMP171-DC-05 - daily loop2 - Status " + VMP_Stat + " Bar High " + WriteVal(Bar_High,1.2) + " Bar Low " + WriteVal(Bar_Low,1.2) + " Bar Volume " + WriteVal(Bar_Volume/1000,1.0) + "K"); _TRACE("VMP171-DC-06 - daily loop2 - Status " + VMP_Stat + " Min Step " + Bar_MinStep + " max Step " + Bar_MaxStep + " Vol PerStep " + WriteVal(Vol_perstep,1.0) + " Steps " + Bar_Steps); } // // //Distribute daily volume equally to all applicable price steps Bar_Volume2 = 0; Max_Volume = 0; for (Step=Bar_MinStep; Step<=Bar_MaxStep; Step++) { //Max_Group_Volume stores value of largest volume at price for ALL periods. //Used to scale VMP relative to largest volume. VMP_Vol = "VMP_Vol_" + mm + "_" + NumToStr(Step,1.0); VarSet(VMP_Vol,VarGet(VMP_Vol) + (Vol_perStep)); // Volume per price step // Bar_Volume2 = IIf(1,Bar_Volume2+Vol_perStep,0); // Alternate to Volume[dd] * Block_Volume = IIf(1,Block_Volume+Vol_perStep,0); // Volume for entire block // if (Debug==1) { _TRACE("VMP171-DC-08 - Max Vol_d Summary - m " + m + " dd " + dd + " Step " + Step + " Volume " + WriteVal(VarGet(VMP_Vol)/1000,1.0) + "K" + " Bar Vol-2 " + Bar_Volume2/1000 + "K"); } } // end Step for loop // Peak_BlockVol = IIf(Peak_BlockVol < VarGet(VMP_Vol),VarGet(VMP_Vol),Peak_BlockVol); // Peak volume for block VMP_Group_PeakVolume = IIf(VarGet(VMP_Vol) >VMP_Group_PeakVolume, VarGet(VMP_Vol),VMP_Group_PeakVolume); // Peak volume for all groups // if (Debug==1) { _TRACE("VMP171-DC-09 - Day Volume_d Summary - m " + m + " Bar Volume " + Bar_Volume/1000 + "K Bar Vol-2 " + Bar_Volume2/1000 + "K"); } // } // end dd for loop // // Create Dynamic Variables for all parameters // UpdateDynamicVars(m); // Set proper subscripts // VarSet(VMP_GroupPeakVol,VMP_Group_PeakVolume); // Peak volume step for all groups - used for scaling chart VarSet(VMP_BlockStartBar,VMPStartBar); // Block Start Bar VarSet(VMP_BlockVol,Block_Volume); // Total Volume for data block - used for diagnostic VarSet(VMP_BlockVol1,Sum_Volume_d1); // Total Volume for data block - used for diagnostic - alternate VarSet(VMP_BlockVol2,Sum_Volume_d2); // Total Volume for data block - used for diagnostic - alternate#2 VarSet(VMP_BlockPeakVol,Peak_BlockVol); // Peak volume for data block - used for scaling chart VarSet(VMP_NumDays,VMPNumDays); // number of bars in data block VarSet(VMP_MinStep,Block_MinStep+1); // Smallest price Block step number VarSet(VMP_MaxStep,Block_MaxStep); // Largest price Block step number VarSet(VMP_BlockHigh,VMPPeriod_High); // Highest price in block VarSet(VMP_BlockLow,VMPPeriod_Low); // Lowest price in block - Compute UVA, LVA, POC // if (Debug==1) { _TRACE("VMP171-DC-10 - Block1 - m " + m + " Block Volume_d Summary - m " + " Numdays " + VMPNumdays + " Sumvol_d 1:2 " + Sum_Volume_d1/1000 + "K / " + Sum_Volume_d2/1000 + "K"); _TRACE("VMP171-DC-11 - Block2 - m " + m + " Dyn Vars: - Start Bar " + VarGet(VMP_BlockStartBar) + " Block Vol-1 " + VarGet(VMP_Blockvol)/1000 + "K Block Vol-2 " + VarGet(VMP_BlockVol1)/1000 + "K Block Vol-3 " + VarGet(VMP_BlockVol2)/1000 + "K"); _TRACE("VMP171-DC-12 - Block3 - m " + m + " Block Vol " + Block_Volume/1000 +"K Block MaxPeakVol " + VarGet(VMP_BlockPeakVol)/1000 + "K" + " Group Peak Vol " + VarGet(VMP_GroupPeakVol)/1000 + "K"); _TRACE("VMP171-DC-13 - Block4 - m " + m + " NumDays " + VarGet(VMP_NumDays) + " Min Step " + VarGet(VMP_MinStep) + " Max Step " + VarGet(VMP_MaxStep)); } } while (m<VMPPeriods); // } // end function DataCollect // ======================================== end of data collection ===================================== // // ======================================= start of data reconstruction ================================ // //Process Data reconstruction for Value area and POC values function DataReconstruct() { //Analyze saved data for display. // FirstBar = FindFirstBar(VMP_TimeFrame); //Read data from prior section and reconstruct to show volume per price //Process one data block per pass (n) n = 0; do { n++; nn = NumToStr(n,1.0); // UpdateDynamicVars(n); // /* //These are redundant vars for diagnostics VarGet(VMP_BlockVol1); // Total Volume for data block VarGet(VMP_BlockVol2); // Total Volume for data block */ // // //Assign value to local variables to speed execution //Scale variables for plotting // if (VMP_scaling ==0) { //Scaled as a group SelVolume = VarGet(VMP_GroupPeakVol)*1.4; } else { //scale each period as 100% SelVolume = VarGet(VMP_BlockPeakVol) *1.4; } // Scale_Factor = VarGet(VMP_NumDays); // Group_PeakValue = VarGet(VMP_GroupPeakVol); // Peak volume step for all groups - used for scaling chart Block_Numdays = VarGet(VMP_NumDays); // number of bars in data block Block_PeakValue = VarGet(VMP_BlockPeakVol); // Peak volume for data block Block_Volume = VarGet(VMP_BlockVol); // Total Volume for data block Block_MinStep = VarGet(VMP_MinStep); // Smallest price Block step number Block_MaxStep = VarGet(VMP_MaxStep); // Largest price Block step number Block_StartBar = VarGet(VMP_BlockStartBar); // Block Start Bar Block_MaxValue = VarGet(VMP_BlockHigh); // Largest price Block Value - Diagnostics only Block_MinValue = VarGet(VMP_BlockLow); // Snallest price Block Value - Diagnostics only // UVA_Var = "UVA_" + nn; LVA_Var = "LVA_" + nn; // //Compute UVA, LVA levels //Compute Value Area upper limit // // if (Debug==1) { _TRACE("VMP171-DR-01 Days - n= " + n + " Numdays " + VMPNumdays); _TRACE("VMP171-DR-02 - Reconstruct - Status " + VMP_Stat + " n " + n + " PLow " + Block_MinValue + " PHigh " + Block_MaxValue + " PMax " + VMPMax_Price + " PMin " + VMPMin_Price); _TRACE("VMP171-DR-03 - Reconstruct - Status " + VMP_Stat + " MinStep " + Block_MinStep + " MaxStep " + Block_MaxStep); } // if (debug) { _TRACE("VMP171-DR-06 - Value Area - Max Step " + Block_MaxStep + " Min Step " + Block_MinStep + " Block Vol " + Block_Volume/1000 + "K BPeak Value " + Block_PeakValue/1000 +"K Group PeakVol " + Group_PeakValue/1000 + "K"); } // //Compute step number for POC - (Max Block Volume) POC_Volume = 0; POC_StepNum = 0; for (i=Block_MinStep-1; i<Block_MaxStep+1; i++) { Vol_i = "VMP_Vol_" + nn + "_" + NumToStr(i,1.0); VMP_Vol = VarGet(Vol_i ); POC_StepNum = IIf(VMP_Vol >POC_Volume,i,POC_StepNum); POC_Volume = IIf(VMP_Vol >POC_Volume,VMP_Vol,POC_Volume); //_TRACE("VMP171-DR-07*** - i " + i +" Voli " + Vol_i + " VMP_Vol " + VMP_Vol + " POC Vol " + POC_Volume + " POC SNum " + POC_StepNum); } // //Compute UVA/LVA. Value area volume should be 70% of toal Block Volume //_TRACE("VMP171-DR-07** - POC Step " + POC_StepNum + " Min Step " + Block_MinStep + " Max Step " + Block_MaxStep); Stepvalue = POC_StepNum; VA_Volume = POC_Volume; kk = Stepvalue +1; jj = Stepvalue -1; Loopcount = 0; do { Loopcount++; Volk = "VMP_Vol_" + nn + "_" + NumToStr(kk,1.0); Volj = "VMP_Vol_" + nn + "_" + NumToStr(jj,1.0); VMP_Volk = VarGet(Volk); VMP_Volj = VarGet(Volj); // VA_Volume = IIf(VMP_Volk >=VMP_Volj,VA_Volume +VMP_Volk,VA_Volume); VA_Volume = IIf(VMP_Volk <= VMP_Volj,VA_Volume +VMP_Volj,VA_Volume); // // //_TRACE("VMP171-DR-07* - lcnt " + loopcount + " kk " + kk + " Max Step " + Block_MaxStep + " Min Step " + Block_MinStep + " jj " + jj + " VAvol " + VA_Volume // + " kvol " + VMP_Volk + " jvol " + VMP_Volj + " BLvol " + Block_Volume); if (VMP_Volk >=VMP_Volj AND kk <=Block_MaxStep) kk++; if (VMP_Volk <= VMP_Volj AND jj >=Block_MinStep) jj--; } while (VA_Volume < 0.7 * Block_Volume AND Loopcount <VMPNumSteps); // upvalstep = kk; dnvalstep = jj; // // UVA_Value = VMPMin_Price +(upvalstep*VMPPrice_Step); // should be block min price + ... //UVA_Value = Block_MinValue +(upvalstep*VMPPrice_Step); // should be block min price + ... VarSet(UVA_Var,UVA_Value); // LVA_Value = VMPMin_Price +(dnvalstep*VMPPrice_Step); //LVA_Value = Block_MinValue +(dnvalstep*VMPPrice_Step); VarSet(LVA_Var,LVA_Value); // // //Find POC step number Max_Volume = i_CPOC = i_PPOC = 0; for (i=Block_MinStep; i<=Block_MaxStep+1; i++) { VMP_Vol = "VMP_Vol_" + nn + "_" + NumToStr(i,1.0); if (VarGet(VMP_Vol) > Max_Volume) { Max_Volume = VarGet(VMP_Vol); // if (n==VMPPeriods-1) i_PPOC = i; if (n==VMPPeriods) i_CPOC = i; // if (debug ==1) { _TRACE("VMP171-DR-09 - n " + n + " Min " + Block_MinStep + " Max " + Block_MaxStep + " Block_PeakValuePval " + Block_PeakValue/1000 + "K Max Val " + Max_Volume/1000 + "K i_PPOC " + i_PPOC + " i_CPOC " + i_CPOC); } } // end VarGet() } // // if (n==VMPPeriods-1) { StaticVarSet("VMP171_RT_P_UVA",VarGet(UVA_Var)); // StaticVarSet("VMP171_RT_P_LVA",VarGet(LVA_Var)); } // if (n==VMPPeriods) { StaticVarSet("VMP171_RT_C_UVA",VarGet(UVA_Var)); // StaticVarSet("VMP171_RT_C_LVA",VarGet(LVA_Var)); } // P_POC_Value = C_POC_Value =0; //initialize if (n==VMPPeriods-1) { P_POC_Value = VMPMin_Price+(i_PPOC*VMPPrice_Step); //P_POC_Value = Block_MinValue+(i_PPOC*VMPPrice_Step); StaticVarSet("VMP171_RT_P_POC",P_POC_Value); } if (n==VMPPeriods) { C_POC_Value = VMPMin_Price+(i_CPOC*VMPPrice_Step); //C_POC_Value = Block_MinValue+(i_CPOC*VMPPrice_Step); StaticVarSet("VMP171_RT_C_POC",C_POC_Value); } // // if (debug) { _TRACE("VMP171 - SVars-1 - n " + n + " UVA " + VarGet(UVA_Var) + " LVA " + VarGet(LVA_Var)); _TRACE("VMP171 - SVars-2 - n " + n + " UVA " + StaticVarGet("VMP171_RT_P_UVA") + " LVA " + StaticVarGet("VMP171_RT_P_LVA")); // _TRACE("VMP171 - SVars-3 - n " + n + " UVA " + VarGet(UVA_Var) + " LVA " + VarGet(LVA_Var)); _TRACE("VMP171 - SVars-4 - n " + n + " UVA " + StaticVarGet("VMP171_RT_C_UVA") + " LVA " + StaticVarGet("VMP171_RT_C_LVA")); // _TRACE("VMP171 - SVars-5 - n " + n + " P_POC " + P_POC_Value + " C_POC " + C_POC_Value); _TRACE("VMP171 - SVars-6 - n " + n + " P_POC " + StaticVarGet("VMP171_RT_P_POC") + " C_POC " + StaticVarGet("VMP171_RT_C_POC")); } if (VMP_Stat==1) { //Compute lines to plot - UVA, LVA for (i=Block_MinStep; i<=Block_MaxStep; i++) { // //Compute Volume Lines VMP_Vol = "VMP_Vol_" + NumToStr(n,1.0) + "_" + NumToStr(i,1.0); x0 = Block_StartBar; x1_ = Nz((VarGet(VMP_Vol) / LastValue(SelVolume) * (Scale_Factor))); xx1_ = IIf(x1_<1,0,x1_); x1 = x0 + xx1_; y0 = y1 = VMPMin_Price + (i*VMPPrice_Step); // if (Debug ==1) { _TRACE("VMP171-PL-01 - n " + n + " i " + i + " x0 " + x0 + " x1 " + x1 + " y0 " + y0 + " x1_ " + x1_); _TRACE("VMP171-PL-02 - n " + n + " Vol " + VarGet(VMP_Vol) + " Numdays " + VMPNumdays + " SelVol " + SelVolume); _TRACE("VMP171-PL-02 - n " + n + " Block Min Step " + Block_MinStep + " Block_MaxStep " + Block_MaxStep); } // Line_Vol = LineArray(x0,y0,x1,y1,0,1); // // if (x0 > LastBar_Number - FirstBar) // Needed to truncate plotting outside of chart { Plot(Line_Vol,"",colorOrange,styleLine|styleNoLabel); } // } // end for Block_MinStep // //Compute and plot UVA, LVA lines x0 = Block_startBar; x1_UpVal = x1_DnVal = x0 + Block_Numdays-1; // y0_UpVal = y1_UpVal = UVA_Value; y0_DnVal = y1_DnVal = LVA_Value; Line_UVA = LineArray(x0,y0_UpVal,x1_UpVal,y1_UpVal,0,1); Line_DVA = LineArray(x0,y0_DnVal,x1_DnVal,y1_DnVal,0,1); // //Plot Start and end points PlotShapes(IIf((Time_Block==1 OR Time_Block==3) AND Bar_Index>=Block_StartBar,shapeCircle,shapeNone),colorYellow,0,Open,0); PlotShapes(IIf((Time_Block==2 OR Time_Block==3) AND Bar_Index>=Block_StartBar,shapeCircle,shapeNone),colorBlue,0,Close,0); //Plot - UVA, LVA Plot(Line_UVA,"",colorWhite,styleDots|styleThick|styleNoLabel); Plot(Line_DVA,"",colorWhite,styleDots|styleThick|styleNoLabel); // // // } // } while (n < VMPPeriods); // // //Plot prices PlotOHLC(O,H,L,C,"",colorBlack,styleCandle); // if (Debug ==1) { _TRACE("VMP171 - ============================= end of data reconstruct ================================"); } } // end function Data Reconstruct // // function Plot_POC_UVA_LVA() { if (debug) _TRACE("VMP171-UVA-LVA-01 - BarCount " + BarCount + " POC " + StaticVarGet("VMP171_RT_P_POC") + " UVA " + StaticVarGet("VMP171_RT_P_UVA") + " LVA " + StaticVarGet("VMP171_RT_P_LVA")); // //Plot current day Value lines and POCs POC_Value = StaticVarGet("VMP171_RT_C_POC"); POC_Line = LineArray(BarCount-5,POC_Value,BarCount-1,POC_Value,0,0); Plot(POC_Line,"",colorRed,styleThick|styleDots|styleNoRescale,0,0,5); UVA_Value = StaticVarGet("VMP171_RT_C_UVA"); UVA_Line = LineArray(BarCount-5,UVA_Value,BarCount-1,UVA_Value,0,0); Plot(UVA_Line,"",colorYellow,styleThick|styleDots|styleNoRescale,0,0,5); LVA_Value = StaticVarGet("VMP171_RT_C_LVA"); LVA_Line = LineArray(BarCount-5,LVA_Value,BarCount-1,LVA_Value,0,0); Plot(LVA_Line,"",colorYellow,styleThick|styleDots|styleNoRescale,0,0,5); // if (debug) _TRACE("VMP171 - UVA / LVA - Enter Section"); //Plot prior day Value lines and POCs POC_Value = StaticVarGet("VMP171_RT_P_POC"); POC_Line = LineArray(BarCount-7,POC_Value,BarCount-1,POC_Value,0,0); Plot(POC_Line,"",colorBlue,styleThick|styleNoRescale,0,0,5); UVA_Value = StaticVarGet("VMP171_RT_P_UVA"); UVA_Line = LineArray(BarCount-7,UVA_Value,BarCount-1,UVA_Value,0,0); Plot(UVA_Line,"",colorWhite,styleThick|styleNoRescale,0,0,5); LVA_Value = StaticVarGet("VMP171_RT_P_LVA"); LVA_Line = LineArray(BarCount-7,LVA_Value,BarCount-1,LVA_Value,0,0); Plot(LVA_Line,"",colorWhite,styleThick|styleNoRescale,0,0,5); // // } // // ================================== end Plot_POC_UVA_LVA() ===================================== // function PlotVolumeStats() { // global PercVolume; //Find number of bars since beginning of time block Bars_inPeriod = BarsSince(Time_Block==1) +1; // if (VMP_Vol_Plot==1) { Vol_Accumulate = Sum(Volume,Bars_InPeriod); Time_Num = TimeNum(); PriorVolume = ValueWhen(TimeNum() ==Time_Num,Vol_Accumulate,2); // xxxxxxxxxxx does not work accurately PercVolume = LastValue(Vol_Accumulate / PriorVolume) * 100; //Plot Accumulated volume scale FirstBar = FindFirstBar(VMP_TimeFrame); VolAcc_High = 5*LastValue(HHV(Vol_Accumulate,FirstBar)); Volume_High = 5*LastValue(HHV(Volume,FirstBar)); // //Mark time for prior period where volume equals current volume Time_Num = LastValue(TimeNum()); BarNum = ValueWhen(Time_Num ==TimeNum(),BarIndex(),2); //Plot(IIf(BarNum==BarIndex(),1,0),"",colorYellow,styleArea|styleOwnScale,0,10); // if (RT AND Now(4) > LastValue(TimeNum())) { Plottime = 1; Plot(Plottime,"",colorPaleGreen,styleArea|styleOwnScale|styleNoLabel,0,20); } Plot(Volume,"",colorWhite,styleDots|styleThick|styleNoLabel|styleNoRescale|styleOwnScale,0,Volume_High); Plot(Vol_Accumulate,"",colorBlue,styleDots|styleThick|styleNoLabel|styleNoRescale|styleOwnScale,0,VolAcc_High); } } // end Plot Volume Stats // // ================================== end Volume Stats ===================================== // ================================== PROGRAM START ===================================== if (Debug==1) { _TRACE("VMP171-0 ============================= PROGRAM START ====================================="); _TRACE("VMP171-00 === ===="); } // // VMPVol_Error = ""; Vol_Test = VerifyVolume(); // // Add VMP_Control parameter for calls from other programs // // // if (Vol_Test ==1 AND VMP_Stat ==1) { //Proceed with program //GetPerformanceCounter(True); DataCollect(VMP_TimeFrame); //GetPerformanceCounter( bReset = True ); // //Time1 = GetPerformanceCounter(True); DataReconstruct(); // // //Plot_Chart = GetPerformanceCounter( bReset = False ); // //Time2 = GetPerformanceCounter(True); if (VMP_Stat ==1) { Plot_POC_UVA_LVA(); //ComputeSRLevels(New_Symbol,RT,1); // //Time3 = GetPerformanceCounter(True); /* if (debug) { _TRACE("VMP171-Time - DC-Time1 " + Time1 + " DR-Time2 " + Time2 + " POC-Time3 " + Time3); _TRACE("VMP171-EOD-0"); } */ // } } if (VMP_Vol_Plot==1) { PlotVolumeStats(); // } else { //There is no volume VolumeTest = VerifyVolume(); if (VolumeTest ==0) VMPVol_Error = "ERROR - No Volume"; } // GraphXSpace = 10; GraphZOrder=1; // _N(Time_Interval = Interval(2)); // _N(Title = Name() + " " + FileName + " " + Time_Interval + " " + " Period " + VMPDispPeriod + " " + DateStamp + " " + TimeStamp + " High " + High + " Low " + Low + " Close " + Close + " Vol " + Volume + " bar# " + Bar_Index + "\nVersion: " + VAP_Version + "\n\nPrior Volume " + PercVolume + "\n\n" + EncodeColor(colorRed) + VMPVol_Error + "\n" + VMPDisplay_Block);