NexusFi: Find Your Edge


Home Menu

 





Some help for a complete EasyLanguage novice


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one seaneking with 3 posts (0 thanks)
    2. looks_two Quick Summary with 1 posts (0 thanks)
    3. looks_3 shadrock55 with 1 posts (0 thanks)
    4. looks_4 ccfeldt with 1 posts (0 thanks)
    1. trending_up 4,538 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread

Some help for a complete EasyLanguage novice

  #1 (permalink)
seaneking
Sydney, Australia.
 
Posts: 3 since Mar 2011
Thanks Given: 0
Thanks Received: 0

Ok so I've been (very) recently teaching myself easylanguage in an attempt to make my trading efforts more efficient and I've run into a few hurdles. I'm not coding with tradestation (using a small australian broker with easylanguage compatibility), so can't debug anything properly or ask for official help from tradestation.

I know I'm asking a fair bit, but any help to point me in the right direction would be really appreciated.

1) I originally wanted to have moving average crossovers to trigger my exits, but it seems that unless the code is running in front of me the orders won't execute (even if they are marketorder function macros), is this right? If so, does the trailingstoporder function require the code to be running 24/7 to be a real trailing stop, as the marketorder function does? If not, and this is a long shot, but is there any way to make it more 'dynamic', perhaps using variables for the tailing amount inputs?
Ideally I'd like to have a trailing stop determined by the ATR of the instrument. ie: average(close,20) - (avgtruerange(14) * 3).

2) Is there any way to build a scanner with easylanguage (independent of the TradeStation scanner tool) so it would go through all the instruments in a market and show canditades that have triggered a buy signal in the last 2 days or something?

3) If 1) is correct in that I need to place stop orders the 'old' way with my broker at predetermined profit points when I enter, then is there a way to automate this process through easylanguage using the macro order functions? For instance, if I place an order after a buy signal is triggered, can it automate placing exit orders at points determined by a few simple calculations (with variables)?


Thanks!
Sean

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trade idea based off three indicators.
Traders Hideout
MC PL editor upgrade
MultiCharts
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Exit Strategy
NinjaTrader
Better Renko Gaps
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
27 thanks
Tao te Trade: way of the WLD
23 thanks
Diary of a simple price action trader
22 thanks
My NQ Trading Journal
14 thanks
GFIs1 1 DAX trade per day journal
9 thanks
  #3 (permalink)
 ccfeldt 
Switzerland
 
Experience: Beginner
Platform: MultiCharts, TradeInterceptor
Trading: Forex
Posts: 13 since Mar 2011
Thanks Given: 0
Thanks Received: 1



seaneking View Post
Ok so I've been (very) recently teaching myself easylanguage in an attempt to make my trading efforts more efficient and I've run into a few hurdles. I'm not coding with tradestation (using a small australian broker with easylanguage compatibility), so can't debug anything properly or ask for official help from tradestation.

I know I'm asking a fair bit, but any help to point me in the right direction would be really appreciated.

1) I originally wanted to have moving average crossovers to trigger my exits, but it seems that unless the code is running in front of me the orders won't execute (even if they are marketorder function macros), is this right? If so, does the trailingstoporder function require the code to be running 24/7 to be a real trailing stop, as the marketorder function does? If not, and this is a long shot, but is there any way to make it more 'dynamic', perhaps using variables for the tailing amount inputs?
Ideally I'd like to have a trailing stop determined by the ATR of the instrument. ie: average(close,20) - (avgtruerange(14) * 3).

2) Is there any way to build a scanner with easylanguage (independent of the TradeStation scanner tool) so it would go through all the instruments in a market and show canditades that have triggered a buy signal in the last 2 days or something?

3) If 1) is correct in that I need to place stop orders the 'old' way with my broker at predetermined profit points when I enter, then is there a way to automate this process through easylanguage using the macro order functions? For instance, if I place an order after a buy signal is triggered, can it automate placing exit orders at points determined by a few simple calculations (with variables)?


Thanks!
Sean

Hi Sean

I'm also only just starting out with EasyLanguage, so take whatever advice with a grain of salt. That said, hopefully this will be of some good, for you or someone else.

1) What do you mean by "unless the code is running in front of me the orders won't execute". What's your current code for the exits? Can you try something like:

********************************************************

If ( average(Close, 50) crosses under Average( Close, 200 ) ) then
Sell ("Close long pos") next bar at market;
BuyToCover("Close short pos") next bar at market;

********************************************************


2) Sorry, don't know if this could be done.

3) Could this help for your exits?

********************************************************

ATR = AvgTrueRange( ATRLength );
MP = MarketPosition;

If ( MP = 1 ) Then
Begin
// Set profit based upon Average True Range
ProfitTarget$ = ATRfactor * ATR * BigPointValue;
SetProfitTarget( ProfitTarget$ );
End;


If ( MP = 1 ) And ( NetProfit > 0 ) Then
Begin
// Set profit based upon percent profit
ProfitTarget$ = ( NetProfit * PrcntGain / 100 );
SetProfitTarget( ProfitTarget$ );
End;

********************************************************

Took these code from another user here on the forum, but didn't note his name. Credit should go to him/her.

Hope that helps
ccfeldt

Reply With Quote
  #4 (permalink)
seaneking
Sydney, Australia.
 
Posts: 3 since Mar 2011
Thanks Given: 0
Thanks Received: 0

For the exits, I meant that unless I'm online and connected to my broker I don't think my code can run, and therefore I believe my exits cant trigger. I'll be offline a fair bit since I'm currently traveling. The only thing I don't know is if this still applies with functions like marketorder and trailingstoporder, using the .placeorder macro to directly place orders with your broker....

Oh, and my exit code is rather similar to the example you posted, just using a triple crossover and the marketorder function instead.

Thanks for that ATR exit strategy, it's a good idea to determine if profit has been made to differentiate approaches, so I'll implement that in the code I have so far. Of course, that is unless I have to scrap my exit code and just place stops when I enter due to the above point...


Thanks,
Sean

Reply With Quote
  #5 (permalink)
seaneking
Sydney, Australia.
 
Posts: 3 since Mar 2011
Thanks Given: 0
Thanks Received: 0

anyone have any ideas to help point me in the right direction?

Reply With Quote
  #6 (permalink)
shadrock55
Marietta, GA U.S.A
 
Posts: 9 since Mar 2011
Thanks Given: 0
Thanks Received: 4

You've got an awkward setup, but you can use setstoploss and setprofittarget and hold your orders on the server (at least if TradeStation is your broker).

The server will only hold the order closest to the current price. For instance, if price is closest to the target, it holds the target. If price is closest to the stoploss, it will hold the stoploss. You will need to adjust your TradeStation setting accordingly.

If you are disconnected from the server, then TradeStation will operate on the latest stop information. You will need to contact TradeStation to do anything other than the last trade transmitted.

Finally, it is not recommended that you leave your strategy unattended or disconnect from the TradeStation server with an automated strategy active. If you can't be at home, you need to look into getting logmein (or some other service) to monitor and manage your trades remotely. Unattended trading is a recipe for disaster.

Reply With Quote




Last Updated on April 4, 2011


© 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