NexusFi: Find Your Edge


Home Menu

 





ProRealTime to TStation Code Conversion


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one jimmy1000 with 3 posts (0 thanks)
    2. looks_two cbritton with 2 posts (2 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 Big Mike with 1 posts (0 thanks)
    1. trending_up 5,067 views
    2. thumb_up 2 thanks given
    3. group 1 followers
    1. forum 6 posts
    2. attach_file 1 attachments




 
Search this Thread

ProRealTime to TStation Code Conversion

  #1 (permalink)
 jimmy1000 
sydney, Australia
 
Experience: Intermediate
Platform: Tradestation
Trading: oil
Posts: 6 since May 2012
Thanks Given: 1
Thanks Received: 0

Hi. I would like to recode a Prorealtime strategy to Easy-Language (for use with TS).

Its based on parabolic-sar and includes a short circuit to halt entrysignals during extremely bearish conditions.

Could anyone assist with the following code:
.......................................................................................................
REM Buy

indicator1 = SAR[0.02,0.02,0.2]
indicator2 = close
c1 = (indicator1 CROSSES OVER indicator2)

indicator3 = MACDline[1,195,1](close)
c2 = (indicator3 > -15.0)

IF c1 AND c2 THEN
BUY 1 SHARES AT MARKET THISBARONCLOSE
ENDIF


REM Sell

indicator4 = SAR[0.02,0.02,0.2]
indicator5 = close
c3 = (indicator4 CROSSES UNDER indicator5)

indicator6 = MACDline[1,195,1](close)
c4 = (indicator6 < -15.0)

IF c3 Or c4 THEN
SELL AT MARKET THISBARONCLOSE
ENDIF

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Cheap historycal L1 data for stocks
Stocks and ETFs
Trade idea based off three indicators.
Traders Hideout
REcommedations for programming help
Sierra Chart
ZombieSqueeze
Platforms and Indicators
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
What is Markets Chat (markets.chat) real-time trading ro …
77 thanks
Spoo-nalysis ES e-mini futures S&P 500
55 thanks
Just another trading journal: PA, Wyckoff & Trends
38 thanks
Bigger Wins or Fewer Losses?
24 thanks
The Program
17 thanks
  #3 (permalink)
 
cbritton's Avatar
 cbritton 
Atlanta, Georgia
 
Experience: Intermediate
Platform: NT
Broker: DDT
Trading: ZN, ZB
Posts: 230 since Mar 2010
Thanks Given: 152
Thanks Received: 256


My first stab at it.

 
Code
inputs:  AfStep( 0.02 ), AfLimit( 0.2 ),
	FastMACDLength( 12 ),
	SlowMACDLength( 26 ),
	MACDAvgLength( 9 ) ;
variables:  oParCl( 0 ), oParOp( 0 ), oPosition( 0 ), oTransition( 0 ),
	MACDValue( 0 );

MACDValue = MACD( Close, FastMACDLength, SlowMACDLength ) ;

Value1 = ParabolicSAR( AfStep, AfLimit, oParCl, oParOp, oPosition, oTransition ) ;

condition1 = oPosition = -1 and close > oParCl and close[1] < oParCl[1];
// another way to watch for "cross over" is when oPosition[1] = -1 and oPosition[0] = 1. i.e. when they switch

condition2 = MACDValue > -15;
if marketPosition = 0 and condition1 and condition2 then
	Buy ( "LE" ) this bar on close ;

condition3 = oPosition = 1 and close < oParCl and close[1] > oParCl[1];
condition4 = MACDValue < -15;
if marketPosition = 0 and condition3 and condition4 then 
	SellShort ("SE") this bar on close;
Obviously, you will need to adjust the input values to match what your Prorealtime code, but I think this approximates what you are looking for. The psar cross over would need to be tweaked a bit, I think. I have not tested this, however.

Regard,
-C

“Strategy without tactics is the slowest route to victory. Tactics without strategy is the noise before defeat.” - Sun Tzu
Reply With Quote
Thanked by:
  #4 (permalink)
 jimmy1000 
sydney, Australia
 
Experience: Intermediate
Platform: Tradestation
Trading: oil
Posts: 6 since May 2012
Thanks Given: 1
Thanks Received: 0

hi cbritton

thanks alot for the prompt reply/code. However it doesnt work. it passes the E-Language verification however no signals are generated.

i kept tweaking it over and over to see if one particular variable was causing it not to work, but that didnt work.

i removed everything relating to MACD and had it try and buy and sell based only on the parabolic sar crosses and this did not work either. it seems it is primarily caused by the use of the Parabolic Sar references.

Also the code you have posted shows sellshort. this is a long only type strategy.

The entries look like this:

freeimagehosting . net /t/69rzq. jpg
(link without the spaces - as i am a new member i cannot post links till post count > 5)

Thanks again.

Started this thread Reply With Quote
  #5 (permalink)
 
cbritton's Avatar
 cbritton 
Atlanta, Georgia
 
Experience: Intermediate
Platform: NT
Broker: DDT
Trading: ZN, ZB
Posts: 230 since Mar 2010
Thanks Given: 152
Thanks Received: 256

I'll try it out later today and hopefully post some updates.

Can you provide some charts with trades from Prorealtime trader with this strategy? I'd like to compare with the same instrument and settings in TS.

Thanks,
-C


jimmy1000 View Post
hi cbritton

thanks alot for the prompt reply/code. However it doesnt work. it passes the E-Language verification however no signals are generated.

i kept tweaking it over and over to see if one particular variable was causing it not to work, but that didnt work.

i removed everything relating to MACD and had it try and buy and sell based only on the parabolic sar crosses and this did not work either. it seems it is primarily caused by the use of the Parabolic Sar references.

Also the code you have posted shows sellshort. this is a long only type strategy.

The entries look like this:

freeimagehosting . net /t/69rzq. jpg
(link without the spaces - as i am a new member i cannot post links till post count > 5)

Thanks again.


“Strategy without tactics is the slowest route to victory. Tactics without strategy is the noise before defeat.” - Sun Tzu
Reply With Quote
  #6 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,463 since Jun 2009
Thanks Given: 33,236
Thanks Received: 101,657


jimmy1000 View Post
(link without the spaces - as i am a new member i cannot post links till post count > 5)

Attach images to your post instead of embedding them.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #7 (permalink)
 jimmy1000 
sydney, Australia
 
Experience: Intermediate
Platform: Tradestation
Trading: oil
Posts: 6 since May 2012
Thanks Given: 1
Thanks Received: 0

no problem BigMike.

Here is a pic of PRT generating/executing the entry/exit signals

Attached Thumbnails
Click image for larger version

Name:	Crude - PRT Sample.jpg
Views:	251
Size:	179.1 KB
ID:	73036  
Started this thread Reply With Quote




Last Updated on May 9, 2012


© 2024 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 - Privacy Policy - Downloads - Top
no new posts