Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
A little help with this. trying a correlation trade with data2,data3 to post trades to data1. This script only has buy/sell/signals at beginning and end of day.
Objective.....data2/data3 has same bullish/bearish signals then buy/sell short next bar data1.
Inputs: cntrcts(1); Setexitonclose;
condition1= close data2>open data2;
condition2= close data3>open data3;
condition3= close data2<open data2;
condition4=close data3<open data3;
if time=0800 then begin;
if condition1 =condition2 then buy next bar at open;
if condition3=condition4 then sell short next bar at open;
end;
No trades registered between begin and exit. Yes, using 2 minute bars.
Can you help answer these questions from other members on NexusFi?
Thank you for quick response. As you can tell I am new to this language. Having removes the begin statement from the
script the chart traded as it should. Problem is I want this to start to monitor conditions at 0800 and close or flatten all positions at 1500 so as to keep in day trade session. It was funny to me as the begin statement would cause order to be created at 0802. How did this happen with the begin statement especially when the script did not meet any conditions yet(long or short order). If I should not use a begin statement, then what should be used to get the desired effect of trading between 0800 and 1500?
Again thanks for looking at this novices problems.
So when you say if time=800 then buy next bar; it will buy at 8:00:001, which is the start of the 8:02 bar. bar time is noted by the end time of the bar.
You might want to use: if time>=800 and time<1500 that would be active between 800 and 1500
to make sure you exit at end of day:
if time=1500 then begin
sell next at market;
buytocover next bar at market;
end;
you might also want to change 1500 to 1458, since it the market actually closes at 1500, if you have time=1500 then order would get sent after market closed.