Easylanguage/Multicharts still buying next bar even no more code to buy signal! - MultiCharts | futures io social day trading
futures io futures trading


Easylanguage/Multicharts still buying next bar even no more code to buy signal!
Updated: Views / Replies:1,934 / 14
Created: by risaldeb Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Easylanguage/Multicharts still buying next bar even no more code to buy signal!

  #1 (permalink)
Trading Apprentice
Hong Kong
 
Futures Experience: Advanced
Platform: Multicharts
Favorite Futures: Options
 
Posts: 10 since Feb 2015
Thanks: 1 given, 0 received

Easylanguage/Multicharts still buying next bar even no more code to buy signal!

I am using Multicharts and Easylanguage program to code the following:
1. Buy if low[1]>Moving average
2. Limit orders from all signal to once per bar was checked.
3. Intrabarordergeneration is true.

However it seemed the code did not recognize the buy if low[1]>MA because even it is false buy signal was generated. I noticed that this happened preceding a stop sell execution the previous bar.

Please help!

Reply With Quote
 
  #2 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,527 since Apr 2013
Thanks: 229 given, 853 received
Forum Reputation: Legendary

risaldeb,

it's hard to tell what is going on without knowing your code. It's possible that you are using a flag for the entry condition check that is not reset and simply stays true, but there are many other reasons. One could only guess without seeing the code.

Regards,
ABCTG

Reply With Quote
 
  #3 (permalink)
 Vendor: tradingcode.net 
The Netherlands
 
Futures Experience: None
Platform: MultiCharts, TradingView
Favorite Futures: ...
 
Jura's Avatar
 
Posts: 774 since Apr 2010
Thanks: 2,347 given, 661 received


I think it might also help if you share what you're trying to do. From the three points that your code does, I get that it should buy when the previous low is above a moving average value. But in point 2 you mention 'orders from all signal'. Does that mean you're combining several signals into one?

So as ABCTG says, post the code (or a reduced example that replicates the problem). But I'd add to that to also clarify your goal(s). Perhaps your code is needlessly complicating things.

Reply With Quote
 
  #4 (permalink)
Trading Apprentice
Hong Kong
 
Futures Experience: Advanced
Platform: Multicharts
Favorite Futures: Options
 
Posts: 10 since Feb 2015
Thanks: 1 given, 0 received


Jura View Post
I think it might also help if you share what you're trying to do. From the three points that your code does, I get that it should buy when the previous low is above a moving average value. But in point 2 you mention 'orders from all signal'. Does that mean you're combining several signals into one?

So as ABCTG says, post the code (or a reduced example that replicates the problem). But I'd add to that to also clarify your goal(s). Perhaps your code is needlessly complicating things.

ABCTG, Jura, Many thanks. Here's the code which is mostly conditional.

NoTrade= Low[1]<var0 or Low<var0;

BuyCondition= (TimeCondition=True)
And (MarketPosition=0)
And (TradeCondition1=True)
//And (TradeCondition2=True)
And oParCl< Low
And (NoTrade=False);

If BuyCondition Then //Begin
Buy ( "Buy-SAR" ) Next Bar at Market;



setstoploss (SellStop);//Why after stop execution a buy order executed on next bar even no buy signal???

SetPercentTrailing( ProfitTrigger$, PctTrailing ) ;
SetProfitTarget( ProfitTarget$ );

Reply With Quote
 
  #5 (permalink)
 Vendor: tradingcode.net 
The Netherlands
 
Futures Experience: None
Platform: MultiCharts, TradingView
Favorite Futures: ...
 
Jura's Avatar
 
Posts: 774 since Apr 2010
Thanks: 2,347 given, 661 received

Your code misses the variables and IOG declaration, which is not a big thing but it makes me wonder whether it's complete.

Why did you choose to use intra-bar order generation, by the way? If you may know, SetStopLoss is also evaluated intra-bar and thus does not need IOG, while IOG can also affect your variables' values (see IntraBarPersist).

Now there's nothing wrong with using IOG, but if you have an issue with your code I'd suggest to bring the code back to its basic form and then step-by-step add each new component to see what breaks it.

Reply With Quote
 
  #6 (permalink)
Trading Apprentice
Hong Kong
 
Futures Experience: Advanced
Platform: Multicharts
Favorite Futures: Options
 
Posts: 10 since Feb 2015
Thanks: 1 given, 0 received

Hi Jura,

I use IOG so it can react to intra day opportunity. Here's what I did. I remove one by one all the buy signals and the result was still the same. That is it still Buy at open after the previous bar was stopped or executed a sell signal. Even I checked the "limit entries from same signal in this strategy to once per bar" it still trade the next bar. I am lost now!

I suspect that a spill over of signal from the previous bar that is executed at the next bar open. How can I ensure that the code will only buy if the condition is true. Right now even if false it still buy then immediately sell it soon after.

Reply With Quote
 
  #7 (permalink)
 Vendor: tradingcode.net 
The Netherlands
 
Futures Experience: None
Platform: MultiCharts, TradingView
Favorite Futures: ...
 
Jura's Avatar
 
Posts: 774 since Apr 2010
Thanks: 2,347 given, 661 received


risaldeb View Post
Here's what I did. I remove one by one all the buy signals and the result was still the same. That is it still Buy at open after the previous bar was stopped or executed a sell signal. Even I checked the "limit entries from same signal in this strategy to once per bar" it still trade the next bar. I am lost now!

I suspect that a spill over of signal from the previous bar that is executed at the next bar open. How can I ensure that the code will only buy if the condition is true. Right now even if false it still buy then immediately sell it soon after.

If I look at the code you previously posted (with the `BuyCondition` variable), then that should buy only if the condition is true. So based on that code snippet I don't see a reason why this behaviour occurs.

Have you tried outputting the variable that you use for submitting buy orders (e.g., `BuyCondition`) on every script calculation to verify that it doesn't remain true?

It might also help to double-check that the variable used for submitting the order (e.g., `BuyCondition`) is only assigned a value above the code that submits the order. If you place `BuyCondition` below the code that submits the order, then this variable will be true on the next script calculation even though it shouldn't be.

Otherwise, can you perhaps post the full script that is causing this problem? Perhaps with more eyes looking at the code we can spot the error faster.

Reply With Quote
 
  #8 (permalink)
Trading Apprentice
Hong Kong
 
Futures Experience: Advanced
Platform: Multicharts
Favorite Futures: Options
 
Posts: 10 since Feb 2015
Thanks: 1 given, 0 received

After isolating buy signal one by one. I think I found the culprit. Since the IOG is True, the buy signal Low[1]>var0 is executed per tick and the code is doing what it meant as coded but not what I intended to do.

I set the chart to 30 minutes and I like the last bar Low should be > var0 to buy. But unfortunately I am not getting it if the last tick low from the previous bar is higher than var0 even if the Low of the previous 30 minute bar is < var0.

How can I code that the last 30 min bar Low is > var0 to buy and IOG = True?

Reply With Quote
 
  #9 (permalink)
 Vendor: tradingcode.net 
The Netherlands
 
Futures Experience: None
Platform: MultiCharts, TradingView
Favorite Futures: ...
 
Jura's Avatar
 
Posts: 774 since Apr 2010
Thanks: 2,347 given, 661 received

Answer
This post has been selected as an answer to the original posters question Answer


risaldeb View Post
I set the chart to 30 minutes and I like the last bar Low should be > var0 to buy. But unfortunately I am not getting it if the last tick low from the previous bar is higher than var0 even if the Low of the previous 30 minute bar is < var0.

How can I code that the last 30 min bar Low is > var0 to buy and IOG = True?

You can use BarStatus to ensure that `var0` is calculated on bar close and not on every tick. For example:

 
Code
Variables:
  var0(0),
  buyOrder(false);

if (BarStatus(1) = 2) then begin

  // Calculate var0 on bar close
  var0 = ...
  
  // Generate the order condition
  if (Low > var0) then
    buyOrder = true;

end;

// This code is executed on every tick
if (buyOrder = true) then begin

  // Submit order

end;

Reply With Quote
The following user says Thank You to Jura for this post:
 
  #10 (permalink)
Trading Apprentice
Hong Kong
 
Futures Experience: Advanced
Platform: Multicharts
Favorite Futures: Options
 
Posts: 10 since Feb 2015
Thanks: 1 given, 0 received


Hi Jurra,

Many thanks. Your code above works. I only changed (BarStatus(1) = 1) then it worked according to my strategy otherwise if it is (BarStatus(1) = 2) it takes the close of the last bar.

Best,
R

Reply With Quote

Reply



futures io > > > > Easylanguage/Multicharts still buying next bar even no more code to buy signal!

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
buy next bar... and set stop immediately and not for the bar after Nicolas11 EasyLanguage Programming 12 September 18th, 2017 05:43 AM
One buy signal from multiple time frames smolarek NinjaTrader 0 March 10th, 2015 12:33 AM
Easylanguage help needed, from signal to function jjsshh EasyLanguage Programming 14 August 5th, 2014 11:05 AM
EasyLanguage entry in active bar on previous bar's low tolu7325 EasyLanguage Programming 3 July 29th, 2013 10:08 AM


All times are GMT -4. The time now is 10:26 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-12 in 0.15 seconds with 39 queries on phoenix via your IP 54.90.92.204