Welcome Guest
You can search the forum and read articles
If you would like to post an article please sign in or Create free account

Sign in





Search articles by Keyword
Search articles by Category
FAQ
  • Trading IQ Game prizes (1)
  • System performances (6)
  • General FAQ (40)
Precision Trading Systems Products
  • Mach-Trend (12)
  • PLA Dynamical (23)
  • Precision Stop (18)
  • Precision Index Oscillator (20)
  • Precision Divergence Finder (8)
  • Demand Index (7)
  • Percent Asymmetric (13)
  • Precision Probability Index (13)
  • Gravity Model (Research project) (2)
Platform type
  • Ninja Trader (44)
  • MultiCharts (32)
  • Tradestation (28)
  • Metatrader 4 (17)
  • Metatrader 5 (10)
  • ESignal (3)
  • Metastock (2)
  • Amibroker (2)
  • SierraChart (2)
Level of experience
  • Advanced (32)
  • Intermediate (40)
  • Beginner (33)
Instrument-Market type
  • Stocks (14)
  • Indices (9)
  • Futures (22)
  • Forex (12)
  • Bonds (3)
Technical Analysis
  • Interesting charts (5)
  • New highs or low breakouts (3)
  • Patterns and Methods (15)
  • Stop losses where to place them (4)
Word Interest rates
  • United Kingdom (5)
  • USA (1)
  • India (0)
  • Japan (0)
Forum opertations
  • Updates needed (0)
  • Suggestions to improve forum (0)
  • Request new category (0)
Trading IQ Game
  • Operations (3)
  • Tips (2)
World News
  • News of interest (6)
  • Stockmarket sensitive news (3)
  • Technological developments (2)
World economy
  • Germany (1)
  • China (0)
  • United Kingdom (2)
  • USA (0)
  • Japan (0)
  • Eurozone (1)
Psychology
  • Human error (8)
  • Trading psychology (6)
  • Self improvement methods (1)
Programming - Code examples
  • Easy Language (9)
  • VB.Net (0)
  • Ninja Script (2)
  • Java (0)
Quantum Physics
  • Strange things (1)
  • Fractals (1)
UK Property
  • London House prices (3)
  • UK House prices (1)
Genius people
  • Albert Einstein (0)
  • Richard Feynman (0)
  • Albert Bartlett (0)
Computing
  • Operating system comparison (0)
Fracking
  • UK Fracking (0)
  • USA Fracking (0)
Futurology
  • Predictions for the future (2)
  • David Goodstein (0)
Philosophy
  • Proverbs (0)
No Image
User id RM1 April 24th 2017
View profile
Forum rating NA
Trading IQ NA
LAST ENTRY PRICE FUNCTION FOR TRADESTATION



A useful function for Tradestation programmers.


User of Tradestation's programming environment may have experienced difficulties with multiple entry price models as the built in function ENTRYPRICE(NUMBER) only refers to the entry price of a new "overall position" rather than an entry of sequence of trades which go to make up an overal position.

The software does not have a function to call the 2nd or 3rd or greater entry prices in a position where several trades are placed.
While developing a Martingale model I ended up creating a special function to do just that so it was easier to call from.

The function is called "LastEntryPrice" and will always call the most recent entryprice regardless of how many entries are employed.

So if you need a triple entry model to work you can use the regular "ENTRYPRICE" function to call the first trade and then the LASTENTRYPRICE function to call the next ones.

Sample code below

//First exit

IF currentcontracts= first_size and marketposition=-1
and ENTRYPRICE-CLOSE > 12.50
THEN BUYTOCOVER ("1st exit short") next bar on highest(high,5) stop;

//Second exit

IF currentcontracts= first_size+Second_Size
and marketposition=-1 and LASTENTRYPRICE-CLOSE > 25
THEN BUYTOCOVER ("2nd exit short") NEXT BAR AT MARKET;


This product will be available upon request on the Tradestation app store if anyone asks me for it.

Some of my other products are now listed there for sale, copy and paste the link below into your browser to see them

https://tradestation.tradingappstore.com/developers/rogermedcalf













Disclaimer