Jump to content

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.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

pitrader

Ma Extension

Recommended Posts

This is for the code writers that like a challenge. I would like to use the following MA (code is below) for a range chart in TS. However range charts have no formal time stamp as to when the bar begins and ends. As a result the extention plots very erratically. Can somebody please show me the code that will allow me to get this working properly. It would be much appreciated..

 

Thanks

 

Pi

 

Inputs: Price( (high+low)/2), Length( 21), Displace( 0) ;

 

Variables: Avg( 0 ),

 

TL (-1);

 

Avg = AverageFC( Price, Length ) ;

 

 

If Displace >= 0 or CurrentBar > AbsValue( Displace ) then

 

 

 

 

Begin

 

Plot1[Displace]( Avg, "Avg" ) ;

 

Once TL=TL_New(Date,Time,0,Date,Time,0);

 

 

 

TL_SetEnd(TL,Date[Displace],Time[Displace],Plot1 [Displace] );

 

TL_SetBegin(TL,Date[Displace+1],Time[Displace+1],Plot1[Displace+1]);

 

TL_SetExtRight(TL,true) ;

 

 

 

TL_SetStyle(TL, tool_solid);

 

TL_SetColor(TL, green);

 

end;

Share this post


Link to post
Share on other sites
This is for the code writers that like a challenge. I would like to use the following MA (code is below) for a range chart in TS. However range charts have no formal time stamp as to when the bar begins and ends. As a result the extention plots very erratically. Can somebody please show me the code that will allow me to get this working properly. It would be much appreciated..

 

Thanks

 

Pi

 

Inputs: Price( (high+low)/2), Length( 21), Displace( 0) ;

 

Variables: Avg( 0 ),

 

TL (-1);

 

Avg = AverageFC( Price, Length ) ;

 

 

If Displace >= 0 or CurrentBar > AbsValue( Displace ) then

 

 

 

 

Begin

 

Plot1[Displace]( Avg, "Avg" ) ;

 

Once TL=TL_New(Date,Time,0,Date,Time,0);

 

 

 

TL_SetEnd(TL,Date[Displace],Time[Displace],Plot1 [Displace] );

 

TL_SetBegin(TL,Date[Displace+1],Time[Displace+1],Plot1[Displace+1]);

 

TL_SetExtRight(TL,true) ;

 

 

 

TL_SetStyle(TL, tool_solid);

 

TL_SetColor(TL, green);

 

end;

 

you can only do it in MultiCharts.

 

MultiCharts can perform analysis down to the seconds level,

while TradeStation can only do minutes. (for now)

 

 

ps. there is no need to start a new thread on this. You should just append the question to your previous thread of the same subject.

Share this post


Link to post
Share on other sites

I am aware that MC has the capability to plot to the second unfortunately I am still using TS. I was told by a EL engineer that there is a way to have this type of indicator work within TS but it takes some pretty tricky programing. Does anybody out there have any experience coding something like this?

 

Thanks

 

Pi

Share this post


Link to post
Share on other sites
I am aware that MC has the capability to plot to the second unfortunately I am still using TS. I was told by a EL engineer that there is a way to have this type of indicator work within TS but it takes some pretty tricky programing. Does anybody out there have any experience coding something like this?

 

Thanks

 

Pi

 

I gave it some more thought...

yes, actually it can be done.

Not only that, I found 3 methods that can achieve the above in TS.

The first method is the classical way, it uses DLL, and requires some serious programming.

This is a logical method; this is what most programmers would think in terms of problem solving. So probably this is what the TS EL engineer was referring to.

The second method uses a trick to get the begin/end points to move forward or backward by 1 or more bars. I have not tested it out yet, this is only a concept.

The third method will require some math... I mean lots of math calculations.

but it can be done.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.