NexusFi: Find Your Edge


Home Menu

 





Buy 1 contract next bar


Discussion in EasyLanguage Programming

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




 
Search this Thread
  #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?
The June 15 Resolution Trap: Irans Agreed Text Still Pri …
Prediction Markets & Event Contracts
MyForexFunds Begins Returning Frozen Funds After CFTC Ca …
Funded Trading Evaluation Firms
Rubios Good News Within Hours and the 30-Day Math: Why H …
Prediction Markets & Event Contracts
Sundays Verdict: Lebanon Locked at 99.85% as Iran June 7 …
Prediction Markets & Event Contracts
Trump Truth Social Fires Hormuz From 10% to 59% -- Arsen …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
197 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
BERN ALGOS algo trading journal
8 thanks
Volume Indicators
8 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642


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 X 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,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642

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 X 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


© 2026 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 - Downloads - Top
no new posts