Hi
I was wondering if theres a way to modify a strategy so that it could be able to buy or sell short on the open of the bar, I already I tried using the bar magnifier with 1 tick but Im still geting the same results in backtest.
Bar magnifier question
It sounds like you are asking two different questions. Bar magnifier would have nothing to do with signal generation. It is purely used to increase back testing as it helps determine how a bar was formed and thus how price flowed.
If you want to generate a signal to buy or sellshort on bar open, that's easy just specify "buy 1 contract next bar at market; for example. If you want to do the open of the bar though, you have to turn IOG=false otherwise next bar is next tick.
If you want to generate a signal to buy or sellshort on bar open, that's easy just specify "buy 1 contract next bar at market; for example. If you want to do the open of the bar though, you have to turn IOG=false otherwise next bar is next tick.
-
- Posts: 33
- Joined: Mar 12 2015
- Has thanked: 4 times
Well, I did that, but I just cant figure out how to set the autotrade or the code to buy at the open of the bar as soon as the buy/sell short signal is triggered, heres the code Im using:It sounds like you are asking two different questions. Bar magnifier would have nothing to do with signal generation. It is purely used to increase back testing as it helps determine how a bar was formed and thus how price flowed.
If you want to generate a signal to buy or sellshort on bar open, that's easy just specify "buy 1 contract next bar at market; for example. If you want to do the open of the bar though, you have to turn IOG=false otherwise next bar is next tick.
Code: Select all
Inputs:
Price(Close),
Length1(13),
Length2(34),
Length3(89),
UpLevel(35),
MidLevel(0),
LwrLevel(-35);
Value1 = jthma(Price,Length1);
Value2 = jthma(Price,Length2);
if Value1 > Value1[1] then buy this bar ;
if Value1 < Value1[1] then sell short this bar
I assume you are not using IOG mode (intra bar order generation)? If so, then you should have the following (note you used this bar, but I use next bar):
if Value1 > Value1[1] then buy next bar at market;
if Value1 < Value1[1] then sell short next bar at market;
You are saying buy this bar but you originally posted you wanted to buy or sell short the open of the next bar correct?
If you are using IOG mode, then the order generation statements above would be the same and you would be buying or selling short the very next tick and NOT the open of the next bar. To do that you need to not be using IOG mode.
if Value1 > Value1[1] then buy next bar at market;
if Value1 < Value1[1] then sell short next bar at market;
You are saying buy this bar but you originally posted you wanted to buy or sell short the open of the next bar correct?
If you are using IOG mode, then the order generation statements above would be the same and you would be buying or selling short the very next tick and NOT the open of the next bar. To do that you need to not be using IOG mode.
-
- Posts: 33
- Joined: Mar 12 2015
- Has thanked: 4 times
Heres a screenshot to explain myself better:I assume you are not using IOG mode (intra bar order generation)? If so, then you should have the following (note you used this bar, but I use next bar):
if Value1 > Value1[1] then buy next bar at market;
if Value1 < Value1[1] then sell short next bar at market;
You are saying buy this bar but you originally posted you wanted to buy or sell short the open of the next bar correct?
If you are using IOG mode, then the order generation statements above would be the same and you would be buying or selling short the very next tick and NOT the open of the next bar. To do that you need to not be using IOG mode.
take a look at #1, A buy signal is triggered and it bought at around 46.30 (the close of the bar) but look at the open of that same bar is around 45.90 (thats the area a want it to buy, or somewhere close to it) a difference of 40 cents more or less.
Now take a look at #2, A short sell is triggered and sold short just below 47.60 (at bar close again) instead of selling short around 48.10 whe the bar opened.
I hope this little explanation helps
Thank you
- Attachments
-
- trendbarsignal.png
- (126.33 KiB) Downloaded 601 times
Your signal is doing what you are telling it to do. You are saying buy or sell short "this bar" when you want it to buy or sell short "next bar"
So when conditions to buy or sell short are met, the signal to do that is generated but now on the next bar, whereas right now you are saying on this bar which is what you don't want.
So when conditions to buy or sell short are met, the signal to do that is generated but now on the next bar, whereas right now you are saying on this bar which is what you don't want.