NexusFi: Find Your Edge


Home Menu

 





Multicharts auto-trading


Discussion in MultiCharts

Updated
    1. trending_up 3,309 views
    2. thumb_up 2 thanks given
    3. group 3 followers
    1. forum 7 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
manant974
france
 
Posts: 5 since Sep 2015
Thanks Given: 2
Thanks Received: 0

[Hello]
Hello
I trade on MultiCharts and I used to buy and sell signals. However, I have problems I can not solve.
These problems concern the uses predefined variables like marketposition , MarketPositionAtBroker and MarketPosition_at_Broker_for_The_Strategy .
So when I make auto trading , I have long position, and no sell short positions . Or in simulated trading , I have both long and sell short positions .
I've tried to use separately arketposition , MarketPositionAtBroker and MarketPosition_at_Broker_for_The_Strategy but i don't have sell short position. I don't understand why
Thank you for your help
Best regard


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Warsh Drops Easing Bias, December Hike Now Above 50% -- …
Prediction Markets & Event Contracts
Roland Garros Final Day: $3M on Zverev at 80.5% -- Leban …
Prediction Markets & Event Contracts
Trump Media to sell instant access to market-moving soci …
Traders Hideout
CME Raises Energy Futures Margins After Iran-War Volatil …
Commodities
April Jobs Beat Flips Fed Hike Odds Past 52% for First T …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
16 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
2 thanks
30 Sessions
1 thanks
CME Expands 24/7 Trading to WTI Crude Oil and Gold -- We …
1 thanks
  #2 (permalink)
 
martingjesus's Avatar
 martingjesus 
Madrid Spain
 
Experience: Master
Platform: Multicharts, Tradestation
Broker: Tradestation, InteractiveBrokers
Trading: Stocks
Posts: 15 since Sep 2015
Thanks Given: 10
Thanks Received: 5

Hi, if you post a piece of the code I think I could help you, I use that functions.

Regards


Follow me on X Reply With Quote
Thanked by:
  #3 (permalink)
manant974
france
 
Posts: 5 since Sep 2015
Thanks Given: 2
Thanks Received: 0


Hello
I use the adaptative moving average by Kaufman for my trading strategy.


Here the code for this indicator

////////// Adaptative moving average ////////////////////////////////////
inputs:
PriceValue( numericseries ),
EffRatioLen( numericsimple ),
FastAvgLen( numericsimple ),
SlowAvgLen( numericsimple ) ;



variables:
var0( 0 ),
var1( 0 ),
var2( 0 ),
var3( 0 ),
var4( 2 / ( SlowAvgLen + 1 ) ),
var5( 2 / ( FastAvgLen + 1 ) ),
var6( var5 - var4 ) ;



if CurrentBar = 1 then
AdaptiveMovAvg = PriceValue
else
begin
var0 = AbsValue( PriceValue - PriceValue[ EffRatioLen ] ) ;
var1 = Summation( AbsValue( PriceValue - PriceValue[1] ), EffRatioLen ) ;
if var1 > 0 then
var2 = var0 / var1
else
var2 = 0 ;

var3 = Square( var4 + var2 * var6 ) ;
AdaptiveMovAvg = AdaptiveMovAvg[1] + var3 * ( PriceValue - AdaptiveMovAvg[1] ) ;
end ;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

With this indicator, I use two signals, the first is used to open buy position and close buy position in the market , and the second for sell short position and close sell short position.
Here the code for buy and close buy signal

//////////////////////////////////////////////////////////////////// Buy and close buy position ///////////////////////////
inputs: PriceValue( Close), Length( 9), Period(20) ,

EffRatioLen( 8),
FastAvgLen(2),
SlowAvgLen( 30) , InitialCapital( 1000);


variables: Counter( 0 ),MP(1) ,
NetChg( 0 ),
indicateur(1.1111),TradeSize( 1000 ),
TotChg( 0 ),
EffRatio( 0 ),
ScaledSFSqr( 0 ),
SlowAvgSF( 2 / ( SlowAvgLen + 1 ) ),
FastAvgSF( 2 / ( FastAvgLen + 1 ) ),
SFDiff( FastAvgSF - SlowAvgSF ) ;

TradeSize=InitialCapital;
MP = MarketPosition_at_Broker;
indicateur=AdaptiveMovAvg(PriceValue,EffRatioLen,FastAvgLen, SlowAvgLen);

if MP = 0 and PriceValue<indicateur then

Buy ( "V" ) TradeSize contracts next bar at market ;

if MP >0 and PriceValue crosses OVER indicateur then
Sell ( "FV" ) TradeSize contracts next bar at market ;


Here the code for sell short and close sell short signal :


/////////////////////////////////////////////////////////// sell short and close sell short signal ////////////////////////
inputs: PriceValue( Close), Length( 9),Period(20),p(0) ,

EffRatioLen( 8),
FastAvgLen( 6), { this input assumed to be a constant >= 1 }
SlowAvgLen( 30) , InitialCapital( 1000);


variables: Counter( 0 ),MP(1) ,
NetChg( 0 ),
indicateur(1.1111),TradeSize( 1000 ),
TotChg( 0 ),
EffRatio( 0 ),
ScaledSFSqr( 0 ),
SlowAvgSF( 2 / ( SlowAvgLen + 1 ) ),
FastAvgSF( 2 / ( FastAvgLen + 1 ) ),
SFDiff( FastAvgSF - SlowAvgSF ) ;

TradeSize=InitialCapital;
MP = MarketPosition_at_Broker;
indicateur=AdaptiveMovAvg(PriceValue,EffRatioLen,FastAvgLen, SlowAvgLen);

if MP = 0 and PriceValue>indicateur then


Sell short ( "V" ) TradeSize contracts next bar at market ;



if MP <0 and PriceValue crosses UNDER indicateur then
Buy to cover ( "FV" ) TradeSize contracts next bar at market ;




When i do backtesting or forward testing, i have buy position and sell short position, for exemple 50 buy positions and 50 sell sell short position. But the problem is about atomated trading in multicharts. I only have a buy position, may be it's due to the market condition, but i used 1 min intraday bar to do trading , and in a week, no sell short position. I think it's due to my programming skill which low.
So i wish that you can help me !!!
Thank you for your response.
Best regards


Reply With Quote
  #4 (permalink)
manant974
france
 
Posts: 5 since Sep 2015
Thanks Given: 2
Thanks Received: 0

I forgot to say you that my automated trading is executed in synchronous mode in multicharts


Reply With Quote
  #5 (permalink)
 
martingjesus's Avatar
 martingjesus 
Madrid Spain
 
Experience: Master
Platform: Multicharts, Tradestation
Broker: Tradestation, InteractiveBrokers
Trading: Stocks
Posts: 15 since Sep 2015
Thanks Given: 10
Thanks Received: 5

The code seems alright, I use marketposition_at_broker the same way as you.. Maybe you are trading some instrument with a short selling restriction?


Follow me on X Reply With Quote
Thanked by:
  #6 (permalink)
manant974
france
 
Posts: 5 since Sep 2015
Thanks Given: 2
Thanks Received: 0

I trade on EUR/USD 1 MIN


Reply With Quote
  #7 (permalink)
manant974
france
 
Posts: 5 since Sep 2015
Thanks Given: 2
Thanks Received: 0

I don't understand the difference between the results in backtesting, forward testing and the automated trading. I just have buy position in automated trading. It's so frustrating


Reply With Quote
  #8 (permalink)
 ilu007 
New York + US
 
Experience: Intermediate
Platform: MultiCharts
Trading: Indian Stocks
Posts: 40 since Aug 2015
Thanks Given: 10
Thanks Received: 2

Hello folks,

I need to know if anyone can use or program the dollar difference tool in Multicharts easylanguage.
means if we draw a trendline it gives the difference of the price...
Please help anyone is aware of it!


Reply With Quote




Last Updated on October 21, 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