Can knowledge of MQL be used in Jforex?(stopLoss,takeProfitPrice)

 
Hi there,
Am a newbie in Forex programming,so I have some doubts in Forex programing.I am learning MQL4,MQL5,and Jforex at the same time.I've almost done with MQL4.
Sine I've been using C#,JAVA,VB.net for a long time,I'd rather start with MQL5
and JForex as they are object oriented languages,but I've found this site very active with lots of experts .

I've seen in many sites the following codes for executing a buy or sell order:

  ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-StopLoss*Point,Ask+TakeProfit*Point,"buy opened",255,0,Lime);
  ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Ask+StopLoss*Point,Bid-TakeProfit*Point,"sell opened",255,0,Red);
So if the above code has been accepted by the experts,the logic should be coded as :
if (orderCmd == OrderCommand.BUY){
 stopLossPrice = history.getLastTick(this.instrument).getBid() - this.stopLossPips * this.instrument.getPipValue();
 takeProfitPrice = history.getLastTick(this.instrument).getAsk() + takeProfitPips * this.instrument.getPipValue();
}else {
 stopLossPrice = history.getLastTick(this.instrument).getAsk() + this.stopLossPips * this.instrument.getPipValue();
 takeProfitPrice = history.getLastTick(this.instrument).getBid() - takeProfitPips * this.instrument.getPipValue();
} 
but what has been used in DukasCopy was different for the Takeprofit.

the API supporter whose knowledge is extensive in my opinion,insisted in that the takeprofit should be as follows:

//I've removed the stopLossPrice code since it was the same as above snippet,and don't want to distract you
  if (orderCmd == OrderCommand.BUY){
        
        takeProfitPrice = history.getLastTick(this.instrument).getBid() + takeProfitPips * this.instrument.getPipValue();
    }else {
        
        takeProfitPrice = history.getLastTick(this.instrument).getAsk() - takeProfitPips * this.instrument.getPipValue();
    } 

and here is his/her reason:
go to platform and make a manual order on a tick chart with close SL and TP values (say 2 pips) and you will clearly see that both TP and SL get executed by the same offer side (i.e. either by BID or ASK). You can also manually move the SL and TP lines to check that this is the case.
For those of you who are interested in whole conversation here is the link

Please,I really need your knowledge.I've already had a private message with WHRoeder,but since I believe the issue could also be useful for other beginners,I've decided to bring it on here.
 

Dear brazandeh
every position consist of two orders at least, ex. the "Buy position" began with oder the broker to BUY specific Asset (now you acquire-have-this asset),

then you decide to eliminate this asset -regardless that you see that it gain enough profit or you don't want more losses-;So you give the broker the oder to redeem it (Close), now the broker will get your Asset (position) and sell in in the Market

he will sell it in the market at Bid price

conclusion :
Buy order is settled at ASK price
Close Buy order settled at Bid price

Sell order is settled in the market at BID price
Close Sell order settled in the market at ASK price

And there is no differences between Jforex and MQL concepts

(this story happened to me with MT4, when i was in sell position with takeProfit, i was observe the chart when the price reached just TP and returned up again without close my position , and i call the broker ask him about this issue, then he told me that 1st the price you see in chart is the Bid price, 2nd the Ask price is greater than Bid by the Spread, So what i saw was a fake price and the settled priced (ASK) is hide in background; witch wasn't reach to my TP yet )


I hope it's clear to understand, and there is more Tricks but i like to keep it simple.
And i am sorry to reopen this thread but it was the Google result.