How to Place Order just once in a candle - AmiBroker | futures io social day trading
futures io futures trading


How to Place Order just once in a candle
Updated: Views / Replies:790 / 2
Created: by raghavan 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
 

How to Place Order just once in a candle

  #1 (permalink)
Trading Apprentice
Bangalore + India
 
Futures Experience: Beginner
Platform: NinjaTrader, MetaTrader
Favorite Futures: Futures
 
Posts: 13 since Jan 2015
Thanks: 3 given, 2 received

How to Place Order just once in a candle

I have a code

 
Code
_SECTION_BEGIN("Test");

SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 

Buy = Cross(MA(C, 5), MA(C, 20));
Short = Cross(MA(C, 20), MA(C, 5)) OR C<O;

Sell = short;
cover = buy;
PlotShapes(shapeUpArrow*Buy, colorBlue, 0, low);
PlotShapes(shapeDownArrow*Short, colorPink, 0, high);


dist = -12;
fnt = "Arial";
fntsize = 8;
txtdist = 25 - dist;
bi = Barindex();
fvb = FirstVisiblevalue( bi );
lvb = LastVisiblevalue( bi );
for( i = fvb; i <= lvb; i++ ) { // iterate through visible chart area only
        if( Buy[i] ) 
            PlotTextSetFont( StrFormat( "B@\n%g", BuyPrice[ i ] ), fnt, fntsize, i, L[ i ], colorBlue, colorDefault, -txtdist + fntsize );
       	if( Short[i] )
            PlotTextSetFont( StrFormat( "Sh@\n%g", ShortPrice[ i ] ), fnt, fntsize, i, H[ i ], colorYellow, colorDefault, txtdist);
}
_SECTION_END();
I am using this in 1 minute candle. What I notice is that, depends on market movement, within same candle, it initially places buy signal and disappears depends on market movement and, after a while, it places short signal and again that disappears too.

May I know how to place these orders only once in a candle and it should not disappear once its placed.

Reply With Quote
 
  #2 (permalink)
Membership Temporarily Revoked
Zurich/Switzerland
 
Futures Experience: Advanced
Platform: -
Favorite Futures: -
 
Posts: 79 since Oct 2014
Thanks: 0 given, 33 received

Do you trade for the first time?

Of course signals disappear in real-time on last bar if calculation includes last bar since MA calculation depends on close price and in your case current price can move above or below of MA while bar is not finished yet. So signals may appear or disappear on very last bar.

If you don't want to calculate on current bar but on previous one(s) then use Ref() to check signal for true/false on previous bar(s).

 
Code
...
Buy = Cross(MA(C, 5), MA(C, 20)); 
Short = Cross(MA(C, 20), MA(C, 5)) OR C<O;

Buy = Ref( Buy, -1 );
Short = Ref( Short, -1 );
...

Or if in realtime you only want to do execute calculation on current bar when it is finished then i.e. use status( "lastbarend" )


Here is a sample function by Janeczko
 
Code
function NewBarJustArrived()
{ // sample function by T. Janeczko
    vname = "lbe" + GetChartID();
    prev = Nz( StaticVarGet( vname ) );
    curr = Status( "lastbarend" );
    StaticVarSet( vname, curr );
    return curr != prev;
}

Example?

Perhaps like this one

 
Code
function NewBarJustArrived()
{ // sample function by T. Janeczko
    vname = "lbe" + GetChartID();
    prev = Nz( StaticVarGet( vname ) );
    curr = Status( "lastbarend" );
    StaticVarSet( vname, curr );
    return curr != prev;
}

shortcond = Cross( MA( C, 20 ), MA( C, 5 ) ) OR C < O;
buycond = Cross( MA( C, 5 ), MA( C, 20 ) );

if( NewBarJustArrived() ) {	
	StaticVarSet( "Buycond", buycond, persist = false );
	StaticVarSet( "Shortcond", shortcond, persist );
} 

Buy = StaticVarGet( "Buycond" );
Short = StaticVarGet( "Shortcond" );

Sell = Short;
Cover = Buy;

//Buy = ExRem( Buy, Sell );
//Sell = ExRem( Sell, Buy );
//Short = ExRem( Short, Cover );
//Cover = ExRem( Cover, Short );

SetChartOptions( 0, chartShowArrows | chartShowDates );
_N( Title = StrFormat( "{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );
Plot( C, "Close", ParamColor( "Color", colorDefault ), styleNoTitle | ParamStyle( "Style" ) | GetPriceStyle() );

PlotShapes( IIf( Buy, shapeUpArrow, shapeNone ), colorBlue, 0, low );
PlotShapes( IIf( Short, shapeDownArrow, shapeNone ), colorPink, 0, high );

dist = -12;
fnt = "Arial";
fntsize = 8;
txtdist = 25 - dist;
bi = Barindex();
fvb = FirstVisiblevalue( bi );
lvb = LastVisiblevalue( bi );
for( i = fvb; i <= lvb; i++ ) { // iterate through visible chart area only
        if( Buy[i] ) 
            PlotTextSetFont( StrFormat( "B@\n%g", BuyPrice[ i ] ), fnt, fntsize, i, L[ i ], colorBlue, colorDefault, -txtdist + fntsize );
       	if( Short[i] )
            PlotTextSetFont( StrFormat( "Sh@\n%g", ShortPrice[ i ] ), fnt, fntsize, i, H[ i ], colorYellow, colorDefault, txtdist);
}
Or whatever ...

Reply With Quote
 
  #3 (permalink)
Trading Apprentice
paris France
 
Futures Experience: Advanced
Platform: Amibroker Motive Wave
Favorite Futures: Stocks
 
Posts: 5 since Mar 2014
Thanks: 1 given, 1 received

the end of the last bar


_SECTION_BEGIN("Test");

// Try this I use Barindex for wait the end of the last bar for trigger the signal

SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );

Buy = Cross(MA(C, 5), MA(C, 20)) & BarIndex() < lastvalue( barindex() );
Short = ( Cross(MA(C, 20), MA(C, 5)) OR C<O ) & BarIndex() < lastvalue( barindex() )

Sell = short;
cover = buy;
PlotShapes(shapeUpArrow*Buy, colorBlue, 0, low);
PlotShapes(shapeDownArrow*Short, colorPink, 0, high);


dist = -12;
fnt = "Arial";
fntsize = 8;
txtdist = 25 - dist;
bi = Barindex();
fvb = FirstVisiblevalue( bi );
lvb = LastVisiblevalue( bi );
for( i = fvb; i <= lvb; i++ ) { // iterate through visible chart area only
if( Buy[i] )
PlotTextSetFont( StrFormat( "B@\n%g", BuyPrice[ i ] ), fnt, fntsize, i, L[ i ], colorBlue, colorDefault, -txtdist + fntsize );
if( Short[i] )
PlotTextSetFont( StrFormat( "Sh@\n%g", ShortPrice[ i ] ), fnt, fntsize, i, H[ i ], colorYellow, colorDefault, txtdist);
}
_SECTION_END();

Reply With Quote

Reply



futures io > > > > How to Place Order just once in a candle

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
TradeStation - How to place an order of GTC duration veeyem TradeStation 5 September 9th, 2014 06:12 AM
Place Order only if No Trades on Current Day have been made JGSmith Elite Automated NinjaTrader Trading 5 July 26th, 2014 11:51 AM
Place text at order entry/exit bar ivanyu EasyLanguage Programming 2 August 5th, 2013 07:20 AM
Is the best way to place a buy limit order by using DOM shots fired ThinkOrSwim 13 April 26th, 2013 06:31 PM
How to place Stop Limit order in MultiCharts Descretionary Trader? safin MultiCharts 1 October 14th, 2011 07:35 AM


All times are GMT -4. The time now is 05:59 PM.

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-15 in 0.10 seconds with 19 queries on phoenix via your IP 54.145.16.43