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)
I am using a set of rules that I came up with a few months ago for real trading on Zumo's platform, 'Firetip'. It has done exceedingly well over the last 51 trading days. But I want to automate it so that I don't have to stress-out all day long. I have the following code written for MC:
MACD1=MACD(Close of Data1,F1,S1); //240-Tick Chart.
MACD1=XAverage(MACD1,L1); //Exit off of this.
MACD2=MACD(Close of Data2,F2,S2); // 480-Tick Chart.
MACD2=XAverage(MACD2,L2); //Enter off of this.
MACD3=MACD(Close of Data3,F3,S3); // 30-min. Chart.
if CurrentBar>2 and Time>T1 and Time<T2 and MarketPosition<=0
and MACD2[1]<0 and MACD2[1]<MACD2[2] and MACD2>MACD2[1] and MACD3>MACD3[1]
and AverageFC(Close of Data2,Y)>OldMA then begin
Buy next bar at market;
MACDBuy=MACD2;
end;
If MarketPosition=1 and MACD1[1]>0 and MACD1<MACD1[1] then Sell next bar at market;
If CurrentBar>2 and Time>T1 and Time<T2 and MarketPosition>=0
and MACD2[1]>0 and MACD2[1]>MACD2[2] and MACD2<MACD2[1] and MACD3<MACD3[1]
and AverageFC(Close of Data2,Y)<OldMA then begin
SellShort next bar at market;
MACDSS=MACD2;
end;
If MarketPosition=-1 and MACD1[1]<0 and MACD1>MACD1[1] BuyToCover next bar at market;
SetStopLoss(400);
SetExitOnClose;
OldMA=AverageFC(Close of Data2,Y);
------------------------------------------------------------------------------------------
I use a 240-Tick chart for Data1 and a 480-Tick chart for Data2. The 240-Tick chart is my SubChart#1.
It is supposed to Enter off Data2 (the 480-Tick chart), then Exit off Data1 (the 240-Tick chart). However, it is Entering off of Data1 and doing so at at the next 480-Tick Bar. The Exits are all right (off of Data1 and the 240-Tick chart).
Can anyone see what I've done wrong in my programming? I've worked on this for several weeks now, in both TradeStation and MultiCharts. Thank you for any help!
-- Bob
Can you help answer these questions from other members on NexusFi?
You should wrap code in the CODE tags on the forum so they are formatted properly and easier to read and cut/paste.
I've also renamed the thread from "this one is my biggie" to "Need help with order entry on multiple dataseries", because we really want and need a descriptive description to help others find this thread in the future.
From skimming your code, you have nothing in the code to tell it to only buy or sell on a specified bar status. Check out barstatus:
Print is your friend. You should add some Print debug output throughout your strategy so you can see what is really happening as the strategy runs through each bar.
BTW, I should mention I am not sure BarStatus is the solution. I've never tried to do exactly what you are trying to do. In my multiple dataseries strategies, I just used the extra dataseries to evaluate something, I didn't care when a particular dataseries closed its bar or opened a new bar.
In NinjaTrader this is referred to as BarsInProgress, I tried to find something similar in MultiCharts but haven't so far.
In looking at your code, I am not entirely sure why you need to exit only at the close of a particular bar type, it seems like you should exit regardless of whether the bar is mid-bar or close or whatever if a condition is met.
Sorry, I hadn't noticed the Code Tag feature above. I'll re-post my code using it.
Thanks for changing the title to something more descriptive.
I don't think the signals really need to know the status of each bar. I just want Entries off of Data#2 and Exits off of Data#1 (the Closes of each of those bars).
If long, and MACD1 one bar ago is above zero, and MACD1 is falling, then Sell next bar at market. I don't see anything "wrong" with the logic, can you post a screen shot of the signal not exiting when it should?
The 'condition to be met' is if the Close of the 480-Tick bar meets my programmed conditions, then I Enter.
To Exit, the 'condition to be met' is if the Close of the 240-Tick bar meets my programmed conditions, then I Exit.
From how I trade in real life, using Firetip, I LOOK at those charts and indicators. As soon as one of the bars Close, if all else is 'right', then I act. That's what I wanted to program into MultiCharts.
Buy next bar at market is always going to buy at the open of the next bar.
If you want intrabar signals, you need to Format Signal, then go to Intra-Bar Order Generation tab (IOG) and enable it, this way it will submit signals on a tick-by-tick basis and not close of bar.
Here's a Screen shot of a Short that was initiated in the wrong place. (By the way, the Exits are good. It's the Entries that are wrong.) It was Shorted off of the MACD Indicator for the Data 1 graph, which is not supposed to be. It was supposed to be Shorted off of the MACD Indicator for the Data 2 graph, according to what I want from my code. The vertical white line is where the MACD reversed down in Data 2.
Buy next bar at market is always going to buy at the open of the next bar.
If you want intrabar signals, you need to Format Signal, then go to Intra-Bar Order Generation tab (IOG) and enable it, this way it will submit signals on a tick-by-tick basis and not close of bar.
Mike
Mike, I don't want intrabar signals. I want the Close of the 480-Tick chart (Data #2) to Enter. That's the way I do it in real life -- that's the way I want it in MultiCharts.
Maybe I'm going about it the wrong way, and I really do appreciate your trying to help me, but that is what I SEE on the Firetip trading platform, before I act. That is what I'm trying to program.