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

[amibroker] Re: Replicating Studies



PureBytes Links

Trading Reference Links



The issue of copying actual studies has been covered a few times from memory Sid but I don't know where it stands.
I created a script for it because I got so sick of not only copying study lines but re-copying them whenever you change one.

The following is a simple display of what I was referring to in my last post.
Add this to any existing script that has a price plot.
Create a text file called levels.txt with a different level value on each line and put it in the root Amibroker folder.
This code just loads that data into static vars when you click the Load button, then displays them.

I use a similar one and find it the fastest way to display horizontal levels across multiple charts. It has the natural advantage that you only have to change a value once in the text file to have it updated across all charts.


showLevels = ParamToggle("Show Levels", "No|Yes");
filename = ParamStr("Filename", "levels.txt");
LoadTrigger = ParamTrigger("Load Levels", "Load Levels");

VarPrefix = "levels";

procedure loadLevels (){
	fh = fopen(filename, "r");
	if(fh) {
		StaticVarRemove(VarPrefix + "*");
		LevelCount = 0;

		while(!feof(fh)){
			Line = fgets(fh);
			LevelCount++;
			LevelValue = StrToNum(Line);
			StaticVarSet(VarPrefix + LevelCount, LevelValue);
		}

		StaticVarSet(VarPrefix + "levelcount", LevelCount);	
		fclose(fh);
	}
}


procedure displayLevels(){
	LevelCount = StaticVarGet(VarPrefix + "levelcount");
	if (!IsEmpty(LevelCount)){
		for (i=1; i<=LevelCount; i++){
			LevelValue = StaticVarGet(VarPrefix + i);
			if (!IsEmpty(LevelValue)){
				Plot(LevelValue, "", colorBlack, styleLine);
			}
		}
	}
}

if(LoadTrigger){
	LoadLevels();
}

if (showLevels){
	displayLevels();
}


The levels.txt file would look something like this
4000
4005
4020
4035
etc

Regards,
Jules.


--- In amibroker@xxxxxxxxxxxxxxx, "Rob" <sidhartha70@xxx> wrote:
>
> Ummm... it's a tricky one. I'm not particularly keen to reinvent the wheel and create my own study plotting interface...
> 
> Before I go down that road I just want to check I'm not missing a more obvious way of replicating studies across charts of different symbols... i.e. highly correlated symbols where the price action is similar enough that they broadly have similar characteristics... for example, reaction highs and lows in roughly the same places... etc
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "jooleanlogic" <jooleanl@> wrote:
> >
> > I just manually write levels in a text file Rob and then have a simple script to load and plot them which you can add to any chart.
> > 
> > You can also prefix different types of levels. E.g.
> > vah,4000
> > poc,3990
> > val,3985
> > vah,3970
> > ...
> > and plot them in different colours or turn different types off/on.
> > 
> > Regards,
> > Jules.
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "Rob" <sidhartha70@> wrote:
> > >
> > > Can anyone think of a good way of 'replicating' studies across charts and symbols...
> > > 
> > > For example, thinking of something very simple... lets pretend I wanted to draw a horizontal line across a reaction low in the ES contract... would there be an easy way of replicating that study in the NQ contract (i.e. across that same reaction low but in a different contract).
> > > 
> > > I need to do something similar across multiple contracts, multiple times... so a way of automating the replication would be very useful.
> > > 
> > > Suggestions appreciated...
> > > 
> > > TIA
> > >
> >
>




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/