update on the automated trading saga: i have multicharts auto trading in real time with real money finally now the small problems to fix. i am currently getting slipped a tick on each side of the trade, though the chart shows this isn't happening lol. so much fun anyway! now i just plan to continue to outsmart it by trial and error adjusting the conditions to get those two ticks recovered. so far the conditions are met to place a trade inside the bar, but as mentioned before MC refuses to place a trade on anything that is better than market after close of the bar. so there is always one tick slippage on entry. on exit using a profit target, once the price has been reached MC is sending a market order to exit causing another tick of slippage. maybe this will help some others and you can save the 20k it has cost me to learn all this. however if i can get this running right that's hamburger money.
As you can see the system will only execute the trade on the close YET the same code will place an arrow where the code tells it. The Blue and Red arrows the system - the Pink arrows are a text tool placed by the same code. This means that SOMETHING IS WRONG [IntrabarOrderGeneration = true] var:intrabarpersist dnband2(0),intrabarpersist upband2(0); dnband2= {the lowest lower band "outside lowest"} upband2= {the highest high band "outside highest"} if c<=dnband2 and c[1]>=dnband2 then begin sell short next bar market; // code above will only sell on close of the bar no matter how you code it. //yet code below will put arrow where instructed by the code above value1=Arw_New_s(Date, Time_s,dnband2, true); //plots the sell arrow at the sell stop price arw_setsize(value1,0); arw_setstyle(value1,3); arw_setcolor(value1,pink); end; if c>=upband2 and c[1]<=upband2 then begin buy next bar market; //code above will on buy on close of bar no matter how you code it. //yet code below will put arrow where instructed by the code above value1=Arw_New_s(Date, Time_s,upband2, false); //plots the sell arrow at the sell stop price arw_setsize(value1,0); arw_setstyle(value1,3); arw_setcolor(value1,pink); https://imagizer.imageshack.com/img924/8546/YX20zP.png < LARGER IMAGE
They seem to be having their own problems? As far as accurately plotting range bars. But I am open to any solution, I would just like for MC to fix this issue and not just say well it work for us. lol https://www.sierrachart.com/SupportBoard.php?ThreadID=47797 https://www.sierrachart.com/SupportBoard.php?ThreadID=47797tps://www.sierrachart.com http://www.sierrachart.com/image.php?Image=1577512522282.png
I don't use range bars, but here is an ES range-bar chart in SC (2 point range). Not sure if it helps, but...
[IntrabarOrderGeneration = true] According to MC Support if you use the above code this will convert the code to act differently on range bars. MC Support says "sell short next bar market" will actually mean next tick market. However no matter how you program it "sell short this bar on close" it will always trade on the close. A very nice person suggested the following. Mark, I took a quick glance at your code logic, and you may need to correct current: if c<=dnband2 and c[1]>=dnband2 then begin sell short next bar market; to this: if c<=dnband2 and c[1]>=dnband2 then begin sell short this bar market; ------ Compiled with error(s): ------ 'This bar' can only be used in close orders. line 18, column 53 Above is the error message when you try the above code. However there was a time in TradeStation when this code would work. MC seems to have taken a different route.
it looks like all the bars are the same size and they all look like they either close on a high or a low and they look like the open of the next bar is always one tick higher or lower than the previous close. all check marks for me - maybe i need to try SC. Thanks at SC looks like another option for me.
Mark, Here is some code you might want to try - just for TESTING purposes. Just Copy it - test it - good luck. [IntrabarOrderGeneration=true]; vars: intrabarpersist OneTick(MinMove/PriceScale); var: intrabarpersist dnband2(0); var: intrabarpersist upband2(0); dnband2=close+1; //I put "close+1" - just for testing purposes - do your own thing here upband2=close-1; //I put "close-1" - just for testing purposes - do your own thing here if c<=dnband2 and c[1]>=dnband2 then begin {The following are 4 examples that you can try. Only remove the "//" on the one you want to try - then replace the "//" when you try another one} {Compile after each change} SellShort next bar at market; //SellShort next bar at open; //SellShort next bar at open+OneTick limit; //SellShort next bar at open-OneTick limit; //SellShort this bar at close; end; VSTscalper
For range bars, if MultiCharts treats the code "sell short next bar at market" actually as next tick, then perhaps it similarly treats the "c[1]" in your code not as the close of "1 bar ago" as you intend but rather of "1 tick ago." This would explain why your executions appear to be 1 (adverse) price increment away from your upper and lower bands -- that would be the moment (if my hypothesis is correct) that your if-then logic becomes true. The logic in your code for your arrow placement is not the same logic for your trade execution and does not create the paradox implied / perceived.
with range bars close means the actual tick - so it really doesn't count as close of bar till it is the close of bar but during the formation of the bar every close is just really a tick.