Waiting for some bars before entry - AmiBroker | futures io social day trading
futures io futures trading


Notices

Waiting for some bars before entry
Updated: Views / Replies:629 / 4
Created: by milkysahai001 Attachments:1

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 100,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
 

Waiting for some bars before entry

  #1 (permalink)
Trading Apprentice
Agra+India
 
Futures Experience: Beginner
Platform: MultiCharts, AmiBroker
Favorite Futures: Stock Futures
 
Posts: 42 since Sep 2016
Thanks: 17 given, 3 received

Waiting for some bars before entry

I want to create a code for scaling in if the same conditions are met 3 times.

i.e., if there is a buy signal and again BUY signal conditions are met before SELL (LongExit) condition, then the system could take the BUY signals upto 3 times and then exit all at the SELL condition.
i have a code which works like this but it generates 3 signals on 3 continuous candles which leads to losses. have attached image for clarity.

now i need to create a code which waits for a certain number of candles before scaling in.

somebody please help!

Attached Thumbnails
Waiting for some bars before entry-1.jpg  
Reply With Quote
 
  #2 (permalink)
Trading Apprentice
paris france
 
Futures Experience: Advanced
Platform: Amibroker
Broker/Data: Interactive Brokers/IQfeed
Favorite Futures: Futures
 
Posts: 8 since Sep 2013
Thanks: 7 given, 5 received

I am not sure to understand you correctly. I guess you want to scale-in every time you get a Buy signal, up to 3 times. And sell your whole position when you get a Sell signal. But you also want to wait for n bars after last Buy signal before buying more. In that case,
let's say your long signals are given by a BuySignal variable and your sell signals by a SellSignal.

 
Code
n = Param("Delay to scale in", 5, 1, 20);
maxScaleIn = Param("Max scale in", 3, 1, 10);

Delay = BarsSince(BuySignal); // Bars since last Buy signal
Pos = Flip(BuySignal, SellSignal); // position in the market

BuyFirst = (Pos > 0) AND (Ref(Pos, -1) <= 0); // first buy signal, no delay
BuyMore = BuySignal AND (Delay >= n); // next signals, n bars delay
BuyNoMore = (Sum(BuyMore, BarsSince(BuyFirst)) + 1) >= maxScaleIn;
Buy = BuyFirst OR BuyMore AND (NOT BuyNoMore);

Similarly for the short side. I haven't check code but it should be ok. Have fun.

Reply With Quote
The following user says Thank You to alligator for this post:
 
  #3 (permalink)
Trading Apprentice
Agra+India
 
Futures Experience: Beginner
Platform: MultiCharts, AmiBroker
Favorite Futures: Stock Futures
 
Posts: 42 since Sep 2016
Thanks: 17 given, 3 received



alligator View Post
I am not sure to understand you correctly. I guess you want to scale-in every time you get a Buy signal, up to 3 times. And sell your whole position when you get a Sell signal. But you also want to wait for n bars after last Buy signal before buying more. In that case,
let's say your long signals are given by a BuySignal variable and your sell signals by a SellSignal.

 
Code
n = Param("Delay to scale in", 5, 1, 20);
maxScaleIn = Param("Max scale in", 3, 1, 10);

Delay = BarsSince(BuySignal); // Bars since last Buy signal
Pos = Flip(BuySignal, SellSignal); // position in the market

BuyFirst = (Pos > 0) AND (Ref(Pos, -1) <= 0); // first buy signal, no delay
BuyMore = BuySignal AND (Delay >= n); // next signals, n bars delay
BuyNoMore = (Sum(BuyMore, BarsSince(BuyFirst)) + 1) >= maxScaleIn;
Buy = BuyFirst OR BuyMore AND (NOT BuyNoMore);

Similarly for the short side. I haven't check code but it should be ok. Have fun.

Alligator,

thanks a lot for your reply. the code is not working though. it is generating only one buy signal instead of three. i will see what can be done now. thanks again.

Reply With Quote
 
  #4 (permalink)
Trading Apprentice
paris france
 
Futures Experience: Advanced
Platform: Amibroker
Broker/Data: Interactive Brokers/IQfeed
Favorite Futures: Futures
 
Posts: 8 since Sep 2013
Thanks: 7 given, 5 received

I don't have time to check, but there's at least on error preventing more than 1 buy. Replace Delay by:

 
Code
Delay = Ref(BarsSince(BuySignal), -1) + 1;

Reply With Quote
The following user says Thank You to alligator for this post:
 
  #5 (permalink)
Trading Apprentice
Agra+India
 
Futures Experience: Beginner
Platform: MultiCharts, AmiBroker
Favorite Futures: Stock Futures
 
Posts: 42 since Sep 2016
Thanks: 17 given, 3 received

Alligator,

its working. Thanks a lot.

Reply With Quote

Reply



futures io > > > > Waiting for some bars before entry

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

How to use the Footprint Tool to Execute Trades w/Brannigan Barrett

Elite only
 

Ask Me Anything (Brokers & Platforms) w/Ilan Levy Mayer @ Cannon Trading

Dec 13
 

Battlestations! Show us your trading desks w/GFF Brokers ($750 in Prizes)

January
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to capture a double value for entry price and int value for entry bar kbaran Elite Automated Trading 3 October 10th, 2012 06:37 PM
Programming Conditionals & Exit x Bars after Entry nanook77 Elite Automated Trading 2 November 9th, 2011 12:54 AM
still waiting kbit Jokes 0 October 14th, 2011 10:45 PM
Using Limit entry, how to know if entry was execute - Multicharts arjfca EasyLanguage Programming 11 November 24th, 2010 05:33 PM
Entry Bars phyzfer NinjaTrader Programming 2 July 17th, 2010 12:49 AM


Tags
amibroker, code, scale in, scaling, signal, signals, variable

All times are GMT -4. The time now is 12:50 AM. (this page content is cached, log in for real-time version)

Copyright © 2018 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 2018-12-09 in 0.10 seconds with 15 queries on phoenix