NexusFi: Find Your Edge


Home Menu

 





Buy 1 contract next bar


Discussion in EasyLanguage Programming

Updated
    1. trending_up 2,706 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?
Warsh Confirmed 54-45 on PPI Day -- 97% Say He Holds in …
Prediction Markets & Event Contracts
Day 96 Missiles Hit Kuwait and Bahrain: June 15 Peace at …
Prediction Markets & Event Contracts
Peace Deal Forward Curve: May 22%, June 51%, December 81 …
Prediction Markets & Event Contracts
Roland Garros Final Day: $3M on Zverev at 80.5% -- Leban …
Prediction Markets & Event Contracts
Iran Update May 8: Still Reviewing MOU, Demands Reparati …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
15 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,643


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

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