NexusFi: Find Your Edge


Home Menu

 





9.1- 9.5


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one Pitrader with 1 posts (0 thanks)
    2. looks_two eronyx with 1 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 ABCTG with 1 posts (0 thanks)
    1. trending_up 1,567 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 Pitrader 
Canada
 
Posts: 12 since Feb 2011

I have an indicator that works just fine on ver 9.1 but I get an error when applied to 9.5 or higher. Placed on a 15 second chart to expedite, once the active bar closes I get a 'Vector is empty or invalid index' error. I have the code below. Any help would be appreciated.

 
Code
 using elsystem ; 								
using elsystem.drawingobjects ; 								
using elsystem.drawing ; 								
								
inputs: 								
	BackBars(10), 							
    PtOffsetPoint(0.5), UniqueID("GGG"); 								
	 							
Vars: 								
	ii(0), ptoffset(0), TextLabel BarCounterTxt( NULL ), TextLabel DeleteText(NULL), BNPoint PosBN( NULL ); 							
	 							
Arrays: TXID[100](0);	 							
method void CreateBNLabel(int barcnt) 								
	begin 							
	{ create position for the text label by bar number using the BNPoint class } 							
	PosBN = BNPoint.Create( CurrentBar - barcnt, Low[barcnt]-PtOffsetPoint) ; 							
		 						
	{ create the text label } 							
	BarCounterTxt = TextLabel.Create( PosBN, Numtostr(barcnt+1,0) ) ; 							
	BarCounterTxt.Font = Font.Create( "Arial", 8 ) ; 							
	BarCounterTxt.HStyle = HorizontalStyle.center ; 							
	BarCounterTxt.VStyle = VerticalStyle.top;							
	BarCounterTxt.Color = Color.Red ; 							
	BarCounterTxt.Tag = UniqueID astype string ;							
		 	 					
	BarCounterTxt.Persist = true ; 							
	end ;	 						
								
method void ShowText() 								
	begin 							
		DrawingObjects.Add( BarCounterTxt ) ; 						
	end;							
//Deleting the Old Texts								
method void deleteAllText()  								
Var: int textList, int textCnt,int jj  ;  								
begin  								
    textList = ObjectCategory.TextLabel;   								
    textCnt = DrawingObjects.Items[textList].Count;  								
    if (LastBarOnChart) then   								
    begin  								
        for jj = 0 to TextCnt - 1   								
        begin  								
            DeleteText = DrawingObjects.Items[textList][jj] astype TextLabel;  								
            if (DeleteText <> NULL) and DeleteText.Tag astype string = UniqueID then DrawingObjects.Delete(DeleteText);  								
        end;  								
    end;  								
end;     								
								
	if (LastBarOnChart) and (BarStatus(1)=2) then 							
	begin 		 					
		deleteAllText();						
		for ii = 0 to BackBars -1						
		begin 						
			CreateBNLabel(ii);					
			ShowText();					
		end; 						
	end;


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Day 96 Missiles Hit Kuwait and Bahrain: June 15 Peace at …
Prediction Markets & Event Contracts
One Wallet Made $200K in Hours: AP Probes Polymarket Cea …
Prediction Markets & Event Contracts
Friday Update: Markets Now Pricing Fed Rate HIKES as Sta …
Traders Hideout
Penalties in Budapest, Peace Deadline in Tehran: Arsenal …
Prediction Markets & Event Contracts
S&P 500 Holds the Line: No Fast Track for SpaceX, Op …
Stocks and ETFs
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
197 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
BERN ALGOS algo trading journal
8 thanks
Volume Indicators
8 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642


Pitrader,

this might be caused by your method that deletes the text, as you loop through elements of the drawing collection and delete elements from it during the loop. This can lead to a situation where you try to access an index that is not longer present in the collection, which would trigger the error.

Regards,

ABCTG


Follow me on X Reply With Quote
  #4 (permalink)
eronyx
Moldova
 
Posts: 9 since Nov 2017
Thanks Given: 6
Thanks Received: 0

Hi

just wondering if you were able to fix the issue? and how it was done


Reply With Quote




Last Updated on April 27, 2020


© 2026 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 - Downloads - Top
no new posts