NexusFi: Find Your Edge


Home Menu

 





Issue with IOG and at market


Discussion in MultiCharts

Updated
      Top Posters
    1. looks_one SlowCarry with 6 posts (0 thanks)
    2. looks_two Fu510n with 2 posts (7 thanks)
    3. looks_3 sptrader with 1 posts (0 thanks)
    4. looks_4 Bimi with 1 posts (0 thanks)
    1. trending_up 3,664 views
    2. thumb_up 7 thanks given
    3. group 4 followers
    1. forum 10 posts
    2. attach_file 2 attachments




 
Search this Thread

Issue with IOG and at market

  #1 (permalink)
SlowCarry
Brisbane, QLD
 
Posts: 8 since Aug 2012
Thanks Given: 1
Thanks Received: 3

Hi,

I'm hoping someone would be able help or point me in the wright direction for using the IOG with buy at market.

My apologies if this has already been posted as I've looked around and could not find anything. This is my first trying to script anything so i do apologies if my question/ observation is stupid/ obvious.

The issue I'm having with IOG is that it appears to be placing the trades at the top of the candles instead of when the IF statement became valid. I've attached the screenshot of this

With IOG off it buys at the next bar as it should.

 
Code
[IntrabarOrderGeneration = True]
Inputs:
wmalength (50),
wmalength1 (1),
Take_Profit (20),
Stop_loss (20);

vars:
wma (0),
wma1 (0),
TickSize (minmove/PriceScale),
tp1 (Take_Profit*ticksize),
sl1 (Stop_loss*ticksize);

wma = WAverage(close,wmalength);
wma1 = WAverage(close,wmalength1);
if marketposition = 0 then
begin
if wma1 > wma then begin
Buy ("Go Long") 5 contracts next bar market;
end;
end;

if marketposition = 1 then
begin
Sell ("L_TP") next bar at (entryprice+Tp1) limit;
sell ("L_SL")next bar at (entryprice-SL1) stop;
end; CurrentAsk

Initially i used the currentBid function but this gave the same results hence i tried the 2 wmas

 
Code
if Currentbid > wma then begin
Buy ("Go Long") 5 contracts next bar market;
end;
Thank you in advance as I've spent the entire night trying to figure this out. With no Luck.

Attached Thumbnails
Click image for larger version

Name:	price.jpg
Views:	158
Size:	617.7 KB
ID:	83946  
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Cheap historycal L1 data for stocks
Stocks and ETFs
REcommedations for programming help
Sierra Chart
MC PL editor upgrade
MultiCharts
ZombieSqueeze
Platforms and Indicators
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
  #2 (permalink)
 RM99 
Austin, TX
 
Experience: Advanced
Platform: TradeStation
Trading: Futures
Posts: 839 since Mar 2011
Thanks Given: 124
Thanks Received: 704

Try changing your stops and targets to a market order and see if it makes a difference. It seems like whenever I use limit orders, I run into orders at the high/low of the bars sometimes, instead of the open close.

Just a thought, might not make a difference. (and yes, I realize those are exits and your concerns are with the entries, but it's worth a try)

"A dumb man never learns. A smart man learns from his own failure and success. But a wise man learns from the failure and success of others."
Reply With Quote
  #3 (permalink)
 
Fu510n's Avatar
 Fu510n 
Suffield, CT
 
Experience: Advanced
Platform: MC, TS, Python, Rust
Broker: IB, IQFeed, TS, Kraken
Trading: ES, NQ, RTY, YM, CL, RB, 6E
Frequency: Several times daily
Duration: Seconds
Posts: 144 since Oct 2009
Thanks Given: 902
Thanks Received: 143


1) Do you have "Build minute and daily bars based on tick data" configured in QuoteManager for EURUSD?
2) How many entries/exits would you like to "allow" (Format Signals->Properties->Enable Intra-Bar Order Generation setting; can be set to one of three settings)
3) Do you have the Bar Magnifier enabled? (Format Signals->Properties->Backtesting->Backtesting Precision->Use Bar Magnifier; set to to 1 tick resolution or whatever you want)

With the above enabled, I get (with your signal/script)...



Hope that helps...
-Guy

p.s. don't forget when using IOG, "Next Bar" really means "Next Tick" and "This Bar at Close" really means "Next Bar" - gotta love IOG

Follow me on Twitter Reply With Quote
  #4 (permalink)
SlowCarry
Brisbane, QLD
 
Posts: 8 since Aug 2012
Thanks Given: 1
Thanks Received: 3

thank you Fu510n,

the Bar Magnifier worked, it enters as it should. So frustrating, so much keayboard bashing for a single tickbox.

Quick question, is there a way to get/set the open/low of the entry candle so to use for Sl or other entry points?

ie, if buy executed on candle 3 from the left then it's open = c3_open, low = c3_low. or something like that?

Reply With Quote
  #5 (permalink)
 
sptrader's Avatar
 sptrader 
Colorado
 
Experience: Advanced
Platform: MultiCharts
Broker: IB & Iqfeed
Trading: ES , CL
Posts: 535 since Apr 2010
Thanks Given: 1,097
Thanks Received: 701


SlowCarry View Post
thank you Fu510n,

the Bar Magnifier worked, it enters as it should. So frustrating, so much keayboard bashing for a single tickbox.

Quick question, is there a way to get/set the open/low of the entry candle so to use for Sl or other entry points?

ie, if buy executed on candle 3 from the left then it's open = c3_open, low = c3_low. or something like that?

************************************************************************************
If you want to refer to the open 3 bars ago, then use Open[3] or O[3] etc for high, low etc..

Reply With Quote
  #6 (permalink)
SlowCarry
Brisbane, QLD
 
Posts: 8 since Aug 2012
Thanks Given: 1
Thanks Received: 3


sptrader View Post
************************************************************************************
If you want to refer to the open 3 bars ago, then use Open[3] or O[3] etc for high, low etc..

sorry the 3 was just an example the, as in the open, high low ect. of the bar where the entry was triggered. The entry could of been 2/5/7/xx bars back from the current bar but i would like to have the values of the entry bar.

Reply With Quote
  #7 (permalink)
SlowCarry
Brisbane, QLD
 
Posts: 8 since Aug 2012
Thanks Given: 1
Thanks Received: 3

Well i managed to get the count bar thing but it appears that its not using the actual values of the candle but rather substitutes the lows/highs with open/close.

From read so far it appears that MC reads only the Open/close of historic bars. Is there a way to makes it read the entire candle?

My very "i seriously need to learn better syntax" if loop.

 
Code
if (count1 = 0 ) then begin
	if (barssinceentry > 0) then begin
		count1 = count1 +1;
			if (barssinceentry > count1) then begin
				count1 = count1 + 1;
			end;		
	end;
end;

Reply With Quote
  #8 (permalink)
Bimi
London
 
Posts: 118 since Mar 2010
Thanks Given: 42
Thanks Received: 58


SlowCarry View Post
Hi,

I'm hoping someone would be able help or point me in the wright direction for using the IOG with buy at market.

My apologies if this has already been posted as I've looked around and could not find anything. This is my first trying to script anything so i do apologies if my question/ observation is stupid/ obvious.

The issue I'm having with IOG is that it appears to be placing the trades at the top of the candles instead of when the IF statement became valid. I've attached the screenshot of this

With IOG off it buys at the next bar as it should.

 
Code
[IntrabarOrderGeneration = True]
Inputs:
wmalength (50),
wmalength1 (1),
Take_Profit (20),
Stop_loss (20);

vars:
wma (0),
wma1 (0),
TickSize (minmove/PriceScale),
tp1 (Take_Profit*ticksize),
sl1 (Stop_loss*ticksize);

wma = WAverage(close,wmalength);
wma1 = WAverage(close,wmalength1);
if marketposition = 0 then
begin
if wma1 > wma then begin
Buy ("Go Long") 5 contracts next bar market;
end;
end;

if marketposition = 1 then
begin
Sell ("L_TP") next bar at (entryprice+Tp1) limit;
sell ("L_SL")next bar at (entryprice-SL1) stop;
end; CurrentAsk

Initially i used the currentBid function but this gave the same results hence i tried the 2 wmas

 
Code
if Currentbid > wma then begin
Buy ("Go Long") 5 contracts next bar market;
end;
Thank you in advance as I've spent the entire night trying to figure this out. With no Luck.

are you talking about backtesting???

Reply With Quote
  #9 (permalink)
SlowCarry
Brisbane, QLD
 
Posts: 8 since Aug 2012
Thanks Given: 1
Thanks Received: 3

Thanks for you help Bimi, but Fu510n fixed the problem for me.

Reply With Quote
  #10 (permalink)
 
Fu510n's Avatar
 Fu510n 
Suffield, CT
 
Experience: Advanced
Platform: MC, TS, Python, Rust
Broker: IB, IQFeed, TS, Kraken
Trading: ES, NQ, RTY, YM, CL, RB, 6E
Frequency: Several times daily
Duration: Seconds
Posts: 144 since Oct 2009
Thanks Given: 902
Thanks Received: 143



SlowCarry View Post
Well i managed to get the count bar thing but it appears that its not using the actual values of the candle but rather substitutes the lows/highs with open/close.

From read so far it appears that MC reads only the Open/close of historic bars. Is there a way to makes it read the entire candle?

My very "i seriously need to learn better syntax" if loop.

 
Code
if (count1 = 0 ) then begin
	if (barssinceentry > 0) then begin
		count1 = count1 +1;
			if (barssinceentry > count1) then begin
				count1 = count1 + 1;
			end;		
	end;
end;

Can you include the code where you're trying to access High/Low vs. Open/Close? Not sure if you're using MessageLog() or not, but you might want to debug that way as well,

e.g.
 
Code
                            
MessageLog"["TotalTrades+1:0:0" | ",
            
FormatDate("M/dd/yyyy"DateToJulianDate )), " "FormatTime("hh:mm:ss tt"DateToJulianDate ) + (TimeToSecondsTime_s ) / 3600 24)), " | ",
            
CurrentBar MaxBarsBack:0:0" | "BarStatus):0:0,
            
"] Open=["Open:0:4"] High=["High:0:4"] Low=["Low:0:4"] Close=["Close:0:4"]" ); 
You can replace "High:0:4" with "High[count1]:0:4" if desired, etc.

Just a thought - need more input

Follow me on Twitter Reply With Quote
Thanked by:




Last Updated on August 10, 2012


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts