This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:

We work extremely hard to keep things positive on our forums.

We do not tolerate rude behavior, trolling, or vendor advertising in posts.

We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.

We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community. It's free and simple, and we will never resell your private information.

can you put in words what you are trying to do?
Your entry price is likely a lot lower than the market price, therefore the limit price won't be executed.
That's why I am asking for your logic, to understand what you are trying to accomplish.

Thanks for the answer ABCTG!
Yes you are right, the price is little bit lower!
I will try to explain:
Stock closes at 100 to day with ATR(10) of 2,5.
I want to buy the stock next day at 99,75.

Thanks ABCTG!
I am getting something wrong, try it in plain English.
Buy Limit = Close - 0,1 * ATR(10)
ProfitTarget = 1 * ATR(10)
StopLoss = 3 *ATR(10)
Exit if TradeDay + 5 sell at market

Seems not so complicated but I am totally stuck....
Here is my code so far:

/gibban

Input: {-------------------------------------------------------------------------------------}
RSIThreshold(10),
RSILookback(2),
ATRThreshold(10),
ATRBuyLimit(0.1),
ATRProfitTarget(1),
ATRStoploss(3),
DayExitPeriod(5);
Variables: {---------------------------------------------------------------------------------}
RSI_Value(0),
MA200(0),
ATR(0),
MP(0);
{=== START OF MAIN PROGRAM ================================================================}
RSI_Value = RSI(Close,RSILookback);
MA200 = Average(Close, 200);
ATR = AverageTrueRange(AtrThreshold);
MP = MarketPosition;
//SetupDay +1 day
If ( RSI_Value <= RSIThreshold ) And ( Close > MA200 ) Then
Buy ("Long") next bar at Close - ATRBuyLimit limit;
//Exit days
If ( Barssinceentry = DayExitPeriod ) Then sell ("DayExitPeriod") this bar at close;
//Stops
//If ATR <= ATRStoploss Then sell ("ATRStoploss") at market;
//If MP = 1 Then Sell ("AAA") next bar at ( EntryPrice - ( ATRStoploss * ATR) ) limit;
//Target
//If MP = 1 then Sell ("LTarget") Next bar at (EntryPrice + (ATRProfitTarget * ATR)) Limit;
//If ( ATRThreshold <> 0 ) Then SetStopLoss( ATRProfitTarget );
{== END OF MAIN PROGRAM ===================================================================}

with the current code your entry is equal to Close - 0.10, which doesn't seem to be what you have in mind.
As you have the ATR computed and stored within a variable already you can do modify your code to this:

//SetupDay +1 day
If ( RSI_Value <= RSIThreshold ) And ( Close > MA200 ) Then
Buy ("Long") next bar at Close - ATRBuyLimit * ATR limit;

Regards,
ABCTG

Gibban

Thanks ABCTG!
I am getting something wrong, try it in plain English.
Buy Limit = Close - 0,1 * ATR(10)
ProfitTarget = 1 * ATR(10)
StopLoss = 3 *ATR(10)
Exit if TradeDay + 5 sell at market

Seems not so complicated but I am totally stuck....
Here is my code so far:

/gibban

Input: {-------------------------------------------------------------------------------------}
RSIThreshold(10),
RSILookback(2),
ATRThreshold(10),
ATRBuyLimit(0.1),
ATRProfitTarget(1),
ATRStoploss(3),
DayExitPeriod(5);
Variables: {---------------------------------------------------------------------------------}
RSI_Value(0),
MA200(0),
ATR(0),
MP(0);
{=== START OF MAIN PROGRAM ================================================================}
RSI_Value = RSI(Close,RSILookback);
MA200 = Average(Close, 200);
ATR = AverageTrueRange(AtrThreshold);
MP = MarketPosition;
//SetupDay +1 day
If ( RSI_Value <= RSIThreshold ) And ( Close > MA200 ) Then
Buy ("Long") next bar at Close - ATRBuyLimit limit;
//Exit days
If ( Barssinceentry = DayExitPeriod ) Then sell ("DayExitPeriod") this bar at close;
//Stops
//If ATR <= ATRStoploss Then sell ("ATRStoploss") at market;
//If MP = 1 Then Sell ("AAA") next bar at ( EntryPrice - ( ATRStoploss * ATR) ) limit;
//Target
//If MP = 1 then Sell ("LTarget") Next bar at (EntryPrice + (ATRProfitTarget * ATR)) Limit;
//If ( ATRThreshold <> 0 ) Then SetStopLoss( ATRProfitTarget );
{== END OF MAIN PROGRAM ===================================================================}

The following user says Thank You to ABCTG for this post:

are you using the build in reserved word SetStopLoss or your own code?
How do you arrive at 93.8 when the closing price is 100 and the ATR[100] is 2? What is the formula you are using to compute the stop price?

Regards,
ABCTG

Gibban

Hi ABCTG!

Can you give me a little hand with the StopLoss function?

Everything is calculated from the closing price on the setup day, and I can not find anything in Easy Language about that at all!

Closing price day X is 100 and ATR[10] is 2, then the StopLoss is suppose to be 93,8.