Go Back   Traders Laboratory > Trading Resources > Trading Indicators > Coding Forum

Coding Forum Collaborate, receive help, or discuss coding related issues.

Reply
Bookmarks
del.icio.us StumbleUpon Google Digg Facebook Furl Reddit Netscape

 
LinkBack Thread Tools Display Modes Language
  #21 (permalink)  
Old 03-27-2008, 09:48 PM
thrunner thrunner is offline
Registered Trader

 
Join Date: Feb 2007
Posts: 154
Thanks: 49
Thanked 34 Times in 17 Posts
Re: Easylanguage and Script Help

Blu-Ray, you've got my vote for the saint of the week
Note to Soultrader, please consider a poll for the most helpful member of the week/month and the most thankful member as well. I think it will promote civility even more than the high standards we already have here at TL.

Here is an attempt at BR's coded strategy for darknite on two data series:
Unfortunately, I think the price action that darknite posted is usually a little bullish and the strategy is usually in the red (note the time frame for $NDX.X is reduced to 15 min to reduce the number of trades. You will also need realtime subscription to both symbols. Workspace and strategy eld in zip file, for 8.3.1419 and above :




Inputs: ProfTarget(30),StopLoss(1 ); { These inputs are in number of ticks } Vars: ShortEntry(0), Permission(0), Mintick(0), mystop(0), MP(0); MP = marketposition; Mintick = minmove/pricescale; Condition1 = C[1] data2 >C[2] data2 and H data2 > H [1]data2 and H data2 > H[2] data2 and C data2 < O data2; if condition1 and MP = 0 then begin ShortEntry = Low - (1*mintick); mystop = High + (Stoploss*mintick); permission = 1; end; if permission = 1 then begin SellShort next bar at ShortEntry Stop; Permission = 0; end; if mp = -1 then begin buytocover ("ProfitTarget") next bar at ShortEntry - (ProfTarget*mintick) limit; buytocover ("StoppedOut") next bar at mystop stop; end;
Attached Images
File Type: gif _3BarPBShort 2008-03-27_213140.gif (16.2 KB, 55 views)
Attached Files
File Type: zip _3barPB_2.zip (4.8 KB, 6 views)

Reply With Quote
The Following 2 Users Say Thank You to thrunner For This Useful Post:
Blu-Ray (03-28-2008), darknite999 (03-28-2008)
  #22 (permalink)  
Old 03-28-2008, 03:04 AM
Soultrader's Avatar
Soultrader Soultrader is offline
Founder of TL!

Trader Specs
 
Join Date: Aug 2006
Location: Tokyo, Japan
Posts: 2,856
Thanks: 56
Thanked 276 Times in 106 Posts
Blog Entries: 9
Send a message via MSN to Soultrader Send a message via Skype™ to Soultrader
Re: Easylanguage and Script Help

Great idea thrunner. Always wanted to do something like it but was never sure of the format of things. I will get to work on it.

__________________
James Lee
Email: JamesLee@traderslaborator y.com
Skype: james.lee03
TradersLaboratory.com

Reply With Quote
  #23 (permalink)  
Old 03-28-2008, 05:00 AM
Blu-Ray's Avatar
Blu-Ray Blu-Ray is offline
Premium Trader

Trader Specs
 
Join Date: Nov 2006
Location: England
Posts: 355
Thanks: 60
Thanked 19 Times in 14 Posts
Re: Easylanguage and Script Help

thrunner,

Thanks for doing that, it's much appreciated.

James,

Would it be possible to add "tsw" ( Tradestation Workspace ) to the list of attachments, it might make things easier in the future.

Cheers

Blu-Ray

__________________
Remember - Take the path of least resistance.
Reply With Quote
  #24 (permalink)  
Old 03-28-2008, 07:18 AM
darknite999 darknite999 is offline
Registered Trader

 
Join Date: Mar 2008
Posts: 25
Thanks: 8
Thanked 0 Times in 0 Posts
Re: Easylanguage and Script Help

Wow!

Thanks so much!

I now only have one problem.

For some reason when using the showme all the points it plots are correct but when using the strategy it only show about 80% of the trades that it should do. Is there something wrong?

Is it possible that I can buy back 30 ticks below the entry on the same bar (if the low goes down that far) if not then the 1st bar that the low gets low enough to buy back at 30 ticks below the entry?

One final thing (I think ) How do I change to script so it won't sell anything when there is 1 hour till closing and then start again the next morning? (To prevent holding trades when the market has closed)

Blu-Ray - I have to hand it to you and everyone else that has been helping me. I appreciated it so much. You don't understand the stress it was causing me that no one could help me. Then I found this forum

Cheers,
Darknite.


Last edited by darknite999; 03-28-2008 at 07:42 AM.
Reply With Quote
  #25 (permalink)  
Old 03-28-2008, 07:51 AM
Blu-Ray's Avatar
Blu-Ray Blu-Ray is offline
Premium Trader

Trader Specs
 
Join Date: Nov 2006
Location: England
Posts: 355
Thanks: 60
Thanked 19 Times in 14 Posts
Re: Easylanguage and Script Help

Quote:
View Post
Wow!

Thanks so much!

I now only have one problem.

For some reason when using the showme all the points it plots are correct but when using the strategy it only show about 80% of the trades that it should do. Is there something wrong?

One final thing (I think ) How do I change to script so it won't sell anything when there is 1 hour till closing and then start again the next morning? (To prevent holding trades when the market has closed)

Blu-Ray - I have to hand it to you and everyone else that has been helping me. I appreciated it so much. You don't understand the stress it was causing me that no one could help me. Then I found this forum

Cheers,
Darknite.
With regards to it only taking 80% of the trades as per the show me, I would guess the next bar did not take out the low of the signal bar, as this strategy only sends the sellshort order on the very next bar.

Here's the revised code with an endtime added as an input:

Inputs:
ProfTarget(30),StopLoss(1 ),endtime(1900);

Vars:
ShortEntry(0), Permission(0), Mintick(0), mystop(0), MP(0);

MP = marketposition;
Mintick = minmove/pricescale;

Condition1 = C[1] data2 >C[2] data2 and H data2 > H [1]data2 and H data2 > H[2] data2 and C data2 < O data2;

if condition1 and MP = 0 and time < endtime then begin
ShortEntry = Low - (1*mintick);
mystop = High + (Stoploss*mintick);
permission = 1;
end;

if permission = 1 then begin
SellShort next bar at ShortEntry Stop;
Permission = 0;
end;

if mp = -1 then begin
buytocover ("ProfitTarget") next bar at ShortEntry - (ProfTarget*mintick) limit;
buytocover ("StoppedOut") next bar at mystop stop;
end;


Also add either of these two lines to the end of the code....

This one will close your position if you've got an open position and it's after the endtime. Note: It will close the position whether it's in profit or loss.

if mp = -1 and time > endtime then buytocover next bar at market;

Or the second one will set the exit on the close of the session, again whether it's in profit or loss. ( But note this should only be used on historical simulations, as depending on the instrument it can lead to your exit being taken on the open of the next day)

if mp = -1 and time > endtime then setexitonclose;


Hope this helps

Blu-Ray

__________________
Remember - Take the path of least resistance.
Reply With Quote
  #26 (permalink)  
Old 03-28-2008, 07:55 AM
Blu-Ray's Avatar
Blu-Ray Blu-Ray is offline
Premium Trader

Trader Specs
 
Join Date: Nov 2006
Location: England
Posts: 355
Thanks: 60
Thanked 19 Times in 14 Posts
Re: Easylanguage and Script Help

Quote:
View Post

Is it possible that I can buy back 30 ticks below the entry on the same bar (if the low goes down that far) if not then the 1st bar that the low gets low enough to buy back at 30 ticks below the entry?
Just noticed your edited part, yes you can. Remove the red line below:

if mp = -1 then begin
buytocover ("ProfitTarget") next bar at ShortEntry - (ProfTarget*mintick) limit;
buytocover ("StoppedOut") next bar at mystop stop;
end;


and the add this to the bottom of the script:

setprofittarget( x );

Note: the profit target is now in dollar amount rather than number of ticks.

Cheers

Blu-Ray

__________________
Remember - Take the path of least resistance.
Reply With Quote
  #27 (permalink)  
Old 03-28-2008, 10:16 AM
darknite999 darknite999 is offline
Registered Trader

 
Join Date: Mar 2008
Posts: 25
Thanks: 8
Thanked 0 Times in 0 Posts
Re: Easylanguage and Script Help

Thanks,

Is it possible I could do it a different way.

Instead of looking for the pattern on data2

I look for the pattern on data1 and trade on data2?

Cheers,
Datknite.

Reply With Quote
  #28 (permalink)  
Old 03-28-2008, 10:19 AM
darknite999 darknite999 is offline
Registered Trader

 
Join Date: Mar 2008
Posts: 25
Thanks: 8
Thanked 0 Times in 0 Posts
Re: Easylanguage and Script Help

And I'm not completely sure if you understood what I meant (probably because of my terrible english but anyway :P )

I mean that once the entry has taken place it sells 30 ticks below the entry the 1st chance it gets. If it is the same bar that has made the profit target of 30 ticks or 2 bars along it will buytocover the 1st chance it gets. (providing the stoploss hasen't bought back anyway)

Once again much thanks,
Darknite.

Reply With Quote
  #29 (permalink)  
Old 03-28-2008, 10:34 AM
Blu-Ray's Avatar
Blu-Ray Blu-Ray is offline
Premium Trader

Trader Specs
 
Join Date: Nov 2006
Location: England
Posts: 355
Thanks: 60
Thanked 19 Times in 14 Posts
Re: Easylanguage and Script Help

Quote:
View Post
And I'm not completely sure if you understood what I meant (probably because of my terrible english but anyway :P )

I mean that once the entry has taken place it sells 30 ticks below the entry the 1st chance it gets. If it is the same bar that has made the profit target of 30 ticks or 2 bars along it will buytocover the 1st chance it gets. (providing the stoploss hasen't bought back anyway)

Once again much thanks,
Darknite.
Darknite

Yes i know what you mean, Here's a chart with your strategy ( data1 only ) using the " SetProfittarget ".

Attached Images
File Type: png Darknite.png (17.1 KB, 45 views)

__________________
Remember - Take the path of least resistance.
Reply With Quote
  #30 (permalink)  
Old 03-28-2008, 10:47 AM
Blu-Ray's Avatar
Blu-Ray Blu-Ray is offline
Premium Trader

Trader Specs
 
Join Date: Nov 2006
Location: England
Posts: 355
Thanks: 60
Thanked 19 Times in 14 Posts
Re: Easylanguage and Script Help

Quote:
View Post
Thanks,

Is it possible I could do it a different way.

Instead of looking for the pattern on data2

I look for the pattern on data1 and trade on data2?

Cheers,
Datknite.
I don't think you can trade a strategy off data2, I'm pretty sure it has to be data1, I'll look into it after hours, unless someone else can verify.

Cheers

Blu-Ray

__________________
Remember - Take the path of least resistance.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
MBT FX Trading Performance Script Sparrow Coding Forum 3 03-06-2008 07:12 AM
Searching TTM Scalper Indicator Script for QuoteTracker ray112 Coding Forum 0 02-06-2008 05:51 AM
Some EasyLanguage Help Please jjthetrader Coding Forum 4 10-14-2007 07:34 PM
Chat Script from Nov. 7, 2006 on Forex Trading Soultrader Chat Room Scripts 0 11-07-2006 02:28 PM
Antonio: Please help me on MP for easylanguage nasdaq5048 Market ProfileŽ 12 10-31-2006 05:53 PM


All times are GMT -4. The time now is 08:05 AM.

 


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58