Manual TP and SL

 

Hello fellow traders,

I have here a drawing that I've made for myself to more easily understand how I am to create manual coded Take Profits and Stop Losses.

Graphical RepresentationThe green X's represent an open order and is called a Point from now on.

I have no problem with the actual coding. I find it really easy.
But I would love to know if I am thinking about this right.

So, in the first scenario we open a Buy position at Point one with only Take Profit set at 10 Pips. When there is 10 Pips of difference between the current Bid Price and the Price we opened the trade at this should tick.

if (Bid >= (OrderOpenPrice + TakeProfit)
	{
		//Close with Profit (Of course at Bid)
	}

In the second one we open another Buy position at Point two with only Stop Loss set at 10 Pips. When the difference between the current Ask price and the price we opened the trade at is over 10 Pips this one should tick.

if (Ask <= (OrderOpenPrice - StopLoss)
	{
		//Close with Loss (Of course at Bid)
	}

Is this okay?
Thanks a lot,
Lovro Mirnik

 
I've figured it out, there is no need to look at the Ask when using Stop Loss, because at the end of the day you're closing it at Bid. There for I rather now set it to look at the Bid price and know exactly at what price and time to close.
 
lovromirnik:  you're closing it at Bid.
Only for buy orders.
 
lovromirnik:
I've figured it out, there is no need to look at the Ask when using Stop Loss, because at the end of the day you're closing it at Bid. There for I rather now set it to look at the Bid price and know exactly at what price and time to close.

On the chart you see only bid prices (op, hi, lo, cl,..).

You enter a buy at ask and exit a buy at bid and you enter a sell at bid and exit a bid at ask.

It is pretty simple you'll always get the worse price of both.

Reason: