NexusFi: Find Your Edge


Home Menu

 





Buy 1 contract next bar


Discussion in EasyLanguage Programming

Updated
    1. trending_up 1,969 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread

Buy 1 contract next bar

  #1 (permalink)
 
tradingest's Avatar
 tradingest 
Milan, Italy
 
Experience: Master
Platform: NT8
Trading: Futures, Forex
Posts: 111 since Dec 2014
Thanks Given: 9
Thanks Received: 11

Hi all,
I can't buy when the price break the pivotH after 3 bars. How Can I make?
Below my code and image where I want the signal buy but this condition verify after 3 bars.

Image - PivotH

Someone can help me?

Thanks,
tradingest

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
ZombieSqueeze
Platforms and Indicators
Cheap historycal L1 data for stocks
Stocks and ETFs
Trade idea based off three indicators.
Traders Hideout
 
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629


tradingest,

I don't see your code in your image, if you can post it I might be able to steer you into the right direction.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #4 (permalink)
 
tradingest's Avatar
 tradingest 
Milan, Italy
 
Experience: Master
Platform: NT8
Trading: Futures, Forex
Posts: 111 since Dec 2014
Thanks Given: 9
Thanks Received: 11


ABCTG View Post
tradingest,

I don't see your code in your image, if you can post it I might be able to steer you into the right direction.

Regards,

ABCTG

Here is my code:

 
Code
Inputs: 
	PriceL(Low),
	LeftStrengthL(3), 
	RightStrengthL(3),
	PriceH(High),
	LeftStrengthH(3), 
	RightStrengthH(3);
	
Variable:
	PivotL(0), PivotH(0), 
	SMA(0), 
	BuyFlag3(false),	
	N(1), MP(0);
	
MP = MarketPosition;

SMA = Average(C,50);


if PivotHighVSBar( 1, PriceH, LeftStrengthH, RightStrengthH, RightStrengthH + 1 ) <> -1
Then Begin
	PivotH = High[RightStrengthH];
	BuyFlag3 = true;
End;



If MP = 0
Then Begin
	If BuyFlag3 = true //and PivotH > SMA
	Then Begin
		Buy N contract next bar at PivotH + 1 point stop;
		BuyFlag3 = false;
	End;
End;

Setprofittarget(1000*N);
Setstoploss(1000*N)

Thanks a lot,
tradingest

Started this thread Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

tradingest,

you reset your BuyFlag3 at the time you send your order. This means on the next bar, the order condition wouldn't be fulfilled anymore and therefore your order would be cancelled, unless filled before of course.
The easiest way might be to store the bar number at the time you set the flag to true and when CurrentBar > SavedBarNumber + X (where X would be the number of bars the order should be valid) or the MarketPosition > 0 (which would indicate an entry), you set the buy flag to false.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #6 (permalink)
 
tradingest's Avatar
 tradingest 
Milan, Italy
 
Experience: Master
Platform: NT8
Trading: Futures, Forex
Posts: 111 since Dec 2014
Thanks Given: 9
Thanks Received: 11


ABCTG View Post
tradingest,

you reset your BuyFlag3 at the time you send your order. This means on the next bar, the order condition wouldn't be fulfilled anymore and therefore your order would be cancelled, unless filled before of course.
The easiest way might be to store the bar number at the time you set the flag to true and when CurrentBar > SavedBarNumber + X (where X would be the number of bars the order should be valid) or the MarketPosition > 0 (which would indicate an entry), you set the buy flag to false.

Regards,

ABCTG

Hi ABCTG,

you could help me to write the code.
I can not express what you have written to me

Thanks,
tradingest

Started this thread Reply With Quote




Last Updated on December 10, 2015


© 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