indiTraders - Forum for the Active Indian Trader  

Go Back   indiTraders - Forum for the Active Indian Trader > Tools > Software > Tradestation

DPonline
Reply
 
Bookmark and Share LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 22-01-2012, 12:44 PM
alex alex is offline
indiTraders VIP
 
Join Date: Mar 2009
Location: Mumbai
Posts: 4,928
Thanks: 14,926
Thanked 13,316 Times in 4,262 Posts
alex has a reputation beyond reputealex has a reputation beyond reputealex has a reputation beyond reputealex has a reputation beyond repute
alex has a reputation beyond reputealex has a reputation beyond reputealex has a reputation beyond reputealex has a reputation beyond reputealex has a reputation beyond reputealex has a reputation beyond reputealex has a reputation beyond reputealex has a reputation beyond reputealex has a reputation beyond reputealex has a reputation beyond reputealex has a reputation beyond reputealex has a reputation beyond reputealex has a reputation beyond repute
Default Logical error in the strategy based on open types

Hi,
I am facing some logical error in below code

Code:
inputs:timeopen(0945);
vars:  od(0);
od = (h-l)*4/5 ;
condition1 = (h-l) >= ((o - l) + od) ;
condition2 = close>open and (h-l)> average((h-l),10);
condition3 = low> low[1] + ((h[1]-l[1])/2) and c >c[1];
if time < timeopen then 
begin
if condition1 and condition2 and condition3 then buy 
this bar at close;
end;
if time<time[1] then begin
value1 = barssinceentry(1);
if value1 >=4 and value1<8 and high> highest(h,3)[1] then buy 
("fe") 2 shares next bar at market; 
end;
setexitonclose;
Logic is, first three conditions defines open type ( in this code it is open drive) in first half an hour after session open.
so far so good, no problem,
Now problem arises with second part of the logic, I want to buy highest high of last 5 bars ( tf is 15 min ) after 1 hr of the session start when above three conditions ( condition1, condition2 and condition3) are true.
Ex. Market opene at 9 am by 9.30 we get signal as open drive. We wait for an hour then afterwords wait for the opportunity to buy when high is greater than highest high of last 5 bars {( h >(h,5)[1]} but MC cant let it happen
because among previous three conditions there is one parameter which says time <0930 ( i.e. time is less than 9.30 am ) so all the code stop working after 9.30am
I have tried barssince entry, barcount = barcount+1 etc but it's somehow not working, I can compile the code but it doesnt reflect on chart as per logic.
posting the chart for reference..



Uploaded with ImageShack.us
__________________
The essence of mathematics is not to make simple things complicated, but to make complicated things simple.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 22-01-2012, 04:53 PM
devdas's Avatar
devdas devdas is offline
edevaay.com
 
Join Date: Mar 2009
Location: Tactical Hell....
Posts: 5,472
Thanks: 15,942
Thanked 18,572 Times in 5,164 Posts
devdas has a reputation beyond reputedevdas has a reputation beyond reputedevdas has a reputation beyond reputedevdas has a reputation beyond repute
devdas has a reputation beyond reputedevdas has a reputation beyond reputedevdas has a reputation beyond reputedevdas has a reputation beyond reputedevdas has a reputation beyond reputedevdas has a reputation beyond reputedevdas has a reputation beyond reputedevdas has a reputation beyond reputedevdas has a reputation beyond reputedevdas has a reputation beyond reputedevdas has a reputation beyond repute
Default

Originally Posted by alex View Post
Hi,
I am facing some logical error in below code

Code:
inputs:timeopen(0945);
vars:  od(0);
od = (h-l)*4/5 ;
condition1 = (h-l) >= ((o - l) + od) ;
condition2 = close>open and (h-l)> average((h-l),10);
condition3 = low> low[1] + ((h[1]-l[1])/2) and c >c[1];
if time < timeopen then 
begin
if condition1 and condition2 and condition3 then buy 
this bar at close;
end;
if time<time[1] then begin
value1 = barssinceentry(1);
if value1 >=4 and value1<8 and high> highest(h,3)[1] then buy 
("fe") 2 shares next bar at market; 
end;
setexitonclose;
Logic is, first three conditions defines open type ( in this code it is open drive) in first half an hour after session open.
so far so good, no problem,
Now problem arises with second part of the logic, I want to buy highest high of last 5 bars ( tf is 15 min ) after 1 hr of the session start when above three conditions ( condition1, condition2 and condition3) are true.
Ex. Market opene at 9 am by 9.30 we get signal as open drive. We wait for an hour then afterwords wait for the opportunity to buy when high is greater than highest high of last 5 bars {( h >(h,5)[1]} but MC cant let it happen
because among previous three conditions there is one parameter which says time <0930 ( i.e. time is less than 9.30 am ) so all the code stop working after 9.30am
I have tried barssince entry, barcount = barcount+1 etc but it's somehow not working, I can compile the code but it doesnt reflect on chart as per logic.
posting the chart for reference..



Uploaded with ImageShack.us


Why not separating "Drive Type" logic from "Exacution" logic in different indicators. Might be then use output of Drive Type as input to execution part.
This might solve ur time clashing problem....i guess.
__________________
Harvest The Moon !!
Nest The Market !!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to devdas For This Useful Post:
  #3 (permalink)  
Old 22-01-2012, 05:59 PM
alex alex is offline
indiTraders VIP
 
Join Date: Mar 2009
Location: Mumbai
Posts: 4,928
Thanks: 14,926
Thanked 13,316 Times in 4,262 Posts
alex has a reputation beyond reputealex has a reputation beyond reputealex has a reputation beyond reputealex has a reputation beyond repute
alex has a reputation beyond reputealex has a reputation beyond reputealex has a reputation beyond reputealex has a reputation beyond reputealex has a reputation beyond reputealex has a reputation beyond reputealex has a reputation beyond reputealex has a reputation beyond reputealex has a reputation beyond reputealex has a reputation beyond reputealex has a reputation beyond reputealex has a reputation beyond reputealex has a reputation beyond repute
Default

Originally Posted by devdas View Post
Why not separating "Drive Type" logic from "Exacution" logic in different indicators. Might be then use output of Drive Type as input to execution part.
This might solve ur time clashing problem....i guess.

D2 in MC we can't run strategy based on indicators, I got what you want to say, I have written function for day types and used it in strategy to execute the signal, but problem is as I said, one part of open types limited for first one hour and execution of buy sell need to run all day and first part wont let it happen. In bmt one member is trying to help me out but so far no luck ( open the thread with the same name )
__________________
The essence of mathematics is not to make simple things complicated, but to make complicated things simple.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

indiTraders - Forum for the Active Indian Trader > Tools > Software > Tradestation


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

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


DPonline

All times are GMT +5.5. The time now is 04:46 PM.


vBulletin Copyright by vBulletin

Content Relevant URLs by vBSEO 3.3.2