Back

Learning Limit Orders in C#

I'm new and I'm still learning.  I'm making strategies just to learn the mechanics.  I had some strategies working when I was using market orders, but I want to use GDAX and avoid fees, so I want to use limit orders.   I can't seem to figure out how to make this work.  I don't seem to be able to make the algorythm be aware that it already has an order submitted seems to be the biggest problem, but i would love any comments on everything I'm doing wrong.

I reduced the code down to just the minimum about Limit Orders to hopefully focus the solution.

Thank you.

Update Backtest








Alright, I'm pretty new as well so hopefully someone else could be of more assistance. When i'm using limit orders I generally use my own trackers since I haven't quite figured out order tracking. As far as this algorithm goes, since it's basically always going back in as soon as it gets out, if price moves too quickly the limit won't get filled, so you need to track time and give it a cancel thing, but you probably won't have this problem in a real algorithm.

Hope this helps!

1


Thanks William, this is helpful.

I was basing my "check" on the code from the QC project "How Do I use Limit Orders" Where they had this code:

//Create the first order
if (_limitOrder == null)

But it clearly wasn't working as I implemented it.

 

Attaching the QC made project.

0


Looking further at their code and a similar "How to use Stop Limit Orders" code I'm wondering if the "== null" is a one time useable equivocation and once it has been set to anything it could never be a null again.  I was thinking when there was no Limit Order (a sale or purchase was made) then the variable would turn to null again.

0

Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed